mysql_fetch_array执行不出结果 也不报错 请指点那错了
<br /> <?php <br /> $uid=$_COOKIE['uid'];<br /> $sql="SELECT * FROM `user` WHERE `id`='$uid'";<br /> echo "$sql";<br /> $query=mysql_query($sql);<br /> $rs=mysql_fetch_array($query);<br /> echo $rs['username'];<br /> ?><br />
echo "$sql"的结果在mysql中执行正常没有错误 即获取cookie参数是正常的
可执行mysql_fetch_array就没有结果 好奇怪
------解决方案--------------------print_r($rs); 看看是什么结果
------解决方案--------------------连接数据库失败。
可以这样写来调试
$query=mysql_query($sql) or die(mysql_error());
------解决方案--------------------连接数据库失败
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