Home >Backend Development >PHP Tutorial >数据读取异常

数据读取异常

WBOY
WBOYOriginal
2016-06-13 10:09:221156browse

数据读取错误
conn.php
$conn=mysql_connect("localhost","mlstudio","ml902975");
mysql_select_db("db_bcty365",$conn);
mysql_query("set names gb2312");
?>

显示页面代码
 
 


 
 
 
 


 
 

 


  $sqluwz=mysql_query("select * from tb_soft order by addtime desc limit 0,7",$conn);
$infouwz=mysql_fetch_array($sqluwz);
if($infouwz==false){ 
?>
 
 
 
 
  }else{
$i=1;
do{  
?>
 
 
 
 
 
 
 
  $i++;
}while($infouwz=mysql_fetch_array($sqluwz));
}
?>
 
数据读取异常
 暂无软件提供下载!
数据读取异常

" class="a1">
  if($i==1)
{
echo "";
}
echo unhtml(msubstr($infouwz["softname"],0,16));
if(strlen($infouwz["softname"])>16)
{
echo " .";
}
  echo "[".substr(str_replace("-","/",$infouwz[addtime]),0,10)."]";  
if($i==1)
{
echo "
";

  ?>
 
 





网页提示错误

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource ……

------解决方案--------------------
你要明白 do....while结构。。。这个不管条件是否成立,都会循环一次。

建议改成:

while($infouwz=mysql_fetch_array($sqluwz))
{
//do something here....
}
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource …… 报这样的错误,你就得在mysql_query($sql)后面加上 or die(mysql_error())看看有没SQL错误。
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