为什么mysql客户端返回有结果,而php 拿不到呢?
RT,我在mysql的客户端命令行上面执行SQL语句:
select count(*) as amount from main where id = 2;
可得到结果
+--------+
| amount |
+--------+
| 1 |
+--------+
但是在php程序里面
$sql1="select count(*) as amount from main where id = 2";
$reqult = mysql_query ( $sql1 );
echo $sql1;
$row = mysql_fetch_row ( $reqult );
$amount = $row [0];
这里的$sql1永远是空值!
而且我把$sql1换成select count(*) as amount from main; 这句又可以正常取到值,
请大侠帮小弟看哈这是个什么问题呗!
我都被这个小问题给弄晕了!
多谢!