I have a script that runs fine on my machine no problem. But when I upload it, I get the error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /.../data-summary.php on line 116
my code in question is the following:
echo "\n\n<p>$query</p>\n\n";
$result = $db->select($query);
while ($row=mysql_fetch_array($result))
{
echo "\n\t\t<tr>
<td><a href=\"data-display.php?schoolid=".$row['id']."\">".$row["SchoolName"]."</a></td>
<td>".$row["NoPupils"]."</td>
<td>".$row["AgeLower"]." – ".$row["AgeUpper"]."</td>
<td>".$row["Gender"]."</td>
<td>".$row["FullBoarders"]."</td>
<tr>\n";
}
and line 116 is the while($row=mysql_fetch_array... line. If I copy the echoed out query and run it from the SQL input on PHP My Admin, the query runs fine and I get 41 results. But when I run the script, nothing.
And as I say, with the same script run locally (on a db that i've exported from my local and then just imported to my online one) it runs without a hitch. I'm using a db class that again runs fine locally.