Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,693 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!