一个很奇怪的问题:同样的一条sql语句,在mysql中能查到记录,而在php中却查不到
具体如下:
mysql中数据表结构:
sql语句:
SELECT ID FROM tradeDetails WHERE userName = '李四' AND goodsID ='1'
php代码:
<?php<br />mysql_connect("localhost","root","root");<br />mysql_query("set names utf-8");<br />mysql_select_db("test");<br /><br />// 为方便说明问题,我把条件参数设为常量<br />$querySql="SELECT ID FROM tradeDetails WHERE userName = '李四' AND goodsID ='1'"; <br /><br />$rs=mysql_query($querySql);<br />$totalRows_myrs=mysql_num_rows($rs); <br />echo $totalRows_myrs;<br />?>