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

Stu Parker
Stu Parker
4,814 Points

passing array through function

um...drawing a blank here.. have returned data through fetchall, using fetch_assoc, but brain melt on passing that array through 4 argument function...

1 Answer

Brian Jensen
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree seal-36
Brian Jensen
Treehouse Staff

Check out this solution by Simon Coates here :point_right: view solution

I have pasted their solution here with syntax highlighting for your convenience:


<?php
include "helper.php";

$rows = $results->fetchall();

foreach ($rows as $row) {
    send_offer($row['member_id'], $row['email'], $row['fullname'], $row['level']);
}
Stu Parker
Stu Parker
4,814 Points

thanks brian...I had tried this but with the fetch_assoc but clearly that was one step too far lol