Home >Backend Development >PHP Tutorial > php与mysql的链接有关问题

php与mysql的链接有关问题

WBOY
WBOYOriginal
2016-06-13 13:24:35690browse

php与mysql的链接问题
代码如下:
26 $sql="SELECT * FROM `information` WHERE user = `$user`";
27 $resule=mysql_query($sql);
28 $row=mysql_fetch_array($resule);
29 if($row[anwser]!=$anwser)
30 echo "";

不知道哪错了,老是报错:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in E:\BBS\password.php on line 28

求高手帮忙解决一下哇

------解决方案--------------------
$resule=mysql_query($sql);

失败了, 看一下mysql_error()
------解决方案--------------------
输入错误时没有弹出"提示答案错误,请重新填写!"对话框?看看生成的html代码中有没有这行html代码。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn