mysql_fetch_array (MYSQL)
I开发者_运维百科'm a beginner and I have a error
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Program Files\VertrigoServ\www\index.php on line 35
and the code...
$sresult = mysql_query("SELECT code, location FROM banners");
while ($row_s = mysql_fetch_array($sresult))
{
$banner[$row_s["location"]]=$row_s["code"];
}
Try this
$sresult = mysql_query("SELECT code, location FROM banners");
if (!$result) {
die('Invalid query: ' . mysql_error());
}
while ($row_s = mysql_fetch_array($sresult))
{
$banner[$row_s["location"]]=$row_s["code"];
}
And check what the error is.
Something is wrong with the query. try:
$result = mysql_query("..");
if(!$result){
echo "Query error: " . mysql_error();
}
精彩评论