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 trialhouzayfa rifai
1,033 PointsI can't Do that
it`s hard to me to understand analyse the code Any Help ?!
<?php
include "helper.php";
/*
* helper.php contains
* $results->query("SELECT member_id, email, fullname, level FROM members");
*/
try{
$results ;
}catch(Exception $e) {
echo "hello world ! ";
}
var_dump($results->fetchAll(PDOStatement::send_offer()));
2 Answers
Tony Thigpen
36,903 PointsThere's no need for the try/catch block. The helper.php contains all of what you'll need for the query already, so what will work here is a foreach loop for all the values to pass into send_offer after running a fetchall for each member.
<?php
include "helper.php";
/*
* helper.php contains
* $results->query("SELECT member_id, email, fullname, level FROM members");
*/
$keys = $results->fetchall();
foreach($keys as $key){
send_offer($key['member_id'], $key['email'], $key['fullname'], $key['level'] );
}
Hope this helps!
Christopher Parke
21,978 PointsWTF when did we use a foreach loop in the last video? Where did you even get that code?