php出现Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result解决办法
程序员文章站
2022-04-08 20:37:50
...
php出现Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
$link= mysql_connect("localhost","root","root")or die("数据库连接失败".mysql_error());
mysql_select_db("student",$link);
mysql_query("set names gb2312");
?>
$sql=mysql_query("select * ftom tb_student");
$info=mysql_fetch_array("$sql");
if($_POST[submit]=="查询")
{
$tex_book=$_POST[tex_book];
$sql=mysql_query("select * ftom tb_student where sno like '%''.trim($tex_book).''%'");
$info=mysql_fetch_array($sql);
}
?>
------解决方案--------------------
$info=mysql_fetch_array("$sql");
=>
$info=mysql_fetch_array($sql);
这里不要加引号。
另外确保select * ftom tb_student这条sql能成功执行。
$link= mysql_connect("localhost","root","root")or die("数据库连接失败".mysql_error());
mysql_select_db("student",$link);
mysql_query("set names gb2312");
?>
$sql=mysql_query("select * ftom tb_student");
$info=mysql_fetch_array("$sql");
if($_POST[submit]=="查询")
{
$tex_book=$_POST[tex_book];
$sql=mysql_query("select * ftom tb_student where sno like '%''.trim($tex_book).''%'");
$info=mysql_fetch_array($sql);
}
?>
------解决方案--------------------
$info=mysql_fetch_array("$sql");
=>
$info=mysql_fetch_array($sql);
这里不要加引号。
另外确保select * ftom tb_student这条sql能成功执行。
相关文章
相关视频
上一篇: 老是出现mysql_fetch_array(): supplied argument is not a valid MySQL result resource
下一篇: PHP的mysql_result()函数
推荐阅读
-
mysql_fetch_array(): supplied argument is not a valid MySQL result resource,该如何处理
-
mysql_fetch_array(): supplied argument is not a valid MySQL result resource....
-
mysql_fetch_array(): supplied argument is not a valid MySQL result resource....
-
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result res,该怎么解决
-
php出现Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result解决办法
-
mysql_fetch_array(): supplied argument is not a valid MySQL result resource,该怎么解决
-
mysql_fetch_array(): supplied argument is not a valid MySQL result resource
-
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resour,该怎么解决
-
mysql_fetch_array(): supplied argument is not a valid MySQL result resource解决方法
-
php出现Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result解决办法