作者appleboy46 (我是道明柏毅)
看板PHP
标题Re: [请益] Mysql Syntax Error
时间Sat May 13 23:39:03 2006
※ 引述《rpuppy (funny)》之铭言:
: Could not run query: You have an error in your SQL syntax; check the manual
: that corresponds to your MySQL server version for the right syntax to use
: near 'check='1'' at line 1
: 程式码如下:
: $sql="select count(*) from $friend where check='1'";
$sql = sprintf("select count(*) from `%s` where `check` = '1'", $friend);
这样写 比较不会有错误 将来也会比较好维护
: $result=mysql_query($sql,$db);
: if(!$result) {
: echo 'Could not run query: ' . mysql_error();
: exit;
: }
: 请问是版本更新所造成的问题吗? 恳请各位大大回答
: 谢谢各位!
--
********************************************************
* 疯狂小恶魔分享讨论区 *
*
http://www.forum.Wu-Boy.com/index.php *
* 无名相簿-appleboy *
*
http://www.wretch.cc/album/appleboy *
********************************************************
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 203.203.237.84
1F:推 rpuppy:可以正常执行了!! 感谢^^ 05/14 01:23