Looping through the Database

the mail() function

Moderators: egami, macek, gesf

Post Reply
User avatar
php-forum Active User
php-forum Active User
Posts: 359
Joined: Tue Feb 22, 2011 8:19 am
Location: Canada

Thu Mar 22, 2012 2:48 pm

You'll want to fetch your query results into a variable and then use a foreach on that variable, e.g.

Code: Select all

$sql = mysqli_query($mysqli,"SELECT x FROM y");
$sql_result = mysqli_fetch_array($sql);

foreach ($sql_result as $value)
if ($value == $something_else)
{some code}
{some more code}

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest