Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Integrating PHP with Databases Using Relational Tables Using a Prepared Statement

Esmee Fulcher
Esmee Fulcher
923 Points

Stuck on using prepare statement task 1

I thought I had the right answer but it isn't right but I don't see what I have done wrong so cannot find the correct answer

index.php
<?php
function get_member() {
    include("connection.php");

    try {
      $results = $db->query(
          "SELECT member_id
          FROM members"
      );
    } catch (Exception $e) {
      echo "bad query";
    }

    $members = $results->fetchAll();
    return $members;
}

1 Answer

Steven Parker
Steven Parker
231,275 Points

It doesn't look like you've changed anything yet, but the instructions for task 1 say "Change the function to accept the single argument for a member_id."

So where the function is defined on line 2, you need to add the parameter name within the parentheses (and don't forget the "$").