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 Querying the Database with PHP Working with Results

Edvin Zigmanovic
Edvin Zigmanovic
7,586 Points

PHP, passing database queries to functions

I'm getting told that "You need to pass all 4 arguments" and after half an hour of trying to fit it I give up.. When I do a "print_r($reult["member_id"])" in the foreach loop for ex. I can actually see the id's "123" being displayed in the "view code" window.

So, why are my 4 argument not passing through the "send_offer()" function/method?

index.php
<?php
include "helper.php";

foreach($results->fetchALL(PDO::FETCH_ASSOC) as $result) {
  send_offer($result["member_id"], $result["email"], $result["fullname"], $result["level"]);
}


/* 
 * helper.php contains
 * $results->query("SELECT member_id, email, fullname, level FROM members");
 */
Simon Coates
Simon Coates
28,694 Points

i just copied your code into that challenged. It passed. no alteration required.

1 Answer

Edvin Zigmanovic
Edvin Zigmanovic
7,586 Points

I restarted my chrome browser and then it worked upon re-submission! Thanks Simon!