I am trying to get a series of nested loops that work to select a database name from a single table, then query the selected table in that database and add the results and display their number and database name.
I got the code to work, but it continues to show:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in
I tried my best, I found online to help, but no one works.
$resulta = mysql_query("SELECT dbname AF012 FROM Customer");
while($data = mysql_fetch_array($resulta))
{
$db = $data[' dbname '];
$result = null;
$result2 = mysql_query("SELECT changemade FROM $db.orders");
while($row = mysql_fetch_array($result2))
{
if( ($row[‘changemade’]== 1) || ($row[‘changemade’]== 2) || ($row[‘changemade’]== 3) ) {
$counter ++;
}
}
unset($result2);
echo $db." ".$counter;
echo "<br>";
$counter = 0;
$result = null;
$result2 = null;
}
All database connections are created and work fine, so it has nothing to do with it. Any help would be great.
source
share