Home > Backend Development > PHP Tutorial > 数据查询问题

数据查询问题

WBOY
Release: 2016-06-23 14:26:12
Original
1095 people have browsed it

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>";}
Copy after login


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


回复讨论(解决方案)

有什么错误信息么?

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

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

晕倒,多了一个

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template