Home  >  Article  >  Backend Development  >  数据查询问题

数据查询问题

WBOY
WBOYOriginal
2016-06-23 14:26:121066browse

require_once './config/conn.php';$asin='6007-00A';$sql="SELECT t.`item_code`,t.`package_area`,t.`asin`,t.`sku`,b.`pack_weight` FROM `1_sku_comparison` t left join `1_product` b on t.`item_code`=b.`item_code` WHERE t.`sku`='".$asin."' OR t.`asin`='".$asin."' OR t.`item_code`='".$asin."'";$query=mysql_query($sql);$rs=mysql_fetch_array($query);$num= mysql_affected_rows();echo $sql."</br>";while($rs=mysql_fetch_array($query)){echo $rs['pack_weight'];echo $rs['item_code'];echo $rs['package_area'];echo "</br>";}


这个语句在phpmyadmin里面能查到记录,我在php里面执行这个语句却查不到记录


回复讨论(解决方案)

有什么错误信息么?

如果结果只有一条,那么你是不可能得到输出的!
去掉第7行的 $rs=mysql_fetch_array($query);

循环取数据的时候,你是从第二条数据开始的,将第七行注释掉

晕倒,多了一个

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