mysql_获取_数组(mysql)
我是初学者,我有一个错误mysql_获取_数组(mysql),mysql,arrays,fetch,Mysql,Arrays,Fetch,我是初学者,我有一个错误 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Program Files\VertrigoServ\www\index.php on line 35 而代码 $sresult = mysql_query("SELECT code, location FROM banners"); while ($row_s = mysql_fetch
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Program Files\VertrigoServ\www\index.php on line 35
而代码
$sresult = mysql_query("SELECT code, location FROM banners");
while ($row_s = mysql_fetch_array($sresult))
{
$banner[$row_s["location"]]=$row_s["code"];
}
这个查询有问题。 尝试: 试试这个
$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"];
}
检查错误是什么。或die()
:-(:-)(-我一直不明白为什么人们一直在使用这个…甚至一开始就开始使用它…同意die(),我个人从来没有在我自己的代码中使用过它,但这是在这里写作时首先想到的,奇怪:)
$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"];
}