作者sionkozx (sionkozx)
看板Database
标题[SQL ] 请教一下这个错误讯息
时间Wed Jun 5 14:06:50 2013
我用maysql+PHP
以下是错误讯息:
SELECT * FROM validate where (serial_number=''9909121913011605' and
v_setting='220' and i_setting='8');
Error: 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
'9909121913011605' and v_setting='220' and i_setting='8')' at line 1 with
query SELECT * FROM validate where (serial_number=''9909121913011605' and
v_setting='220' and i_setting='8');
我知道问题出在那个引号~
我的temp[2]本身就是'9909121913011605
用过很多种方式还是没办法顺利搜寻~
serial_number我要储存为前面有带一个引号的字串共17码~
但是都会出现
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
resource in XXXX错误。
以下是程式码:
$query="SELECT * FROM validate where (serial_number='$temp[2]' and
v_setting='$temp[4]' and i_setting='$temp[5]');";
$result=mysql_query($query) or die("Error: ". mysql_error(). " with
query ". $query);
$countone = mysql_num_rows($result);//有几笔
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 60.250.193.248
1F:→ lbeeon:加逃脱字元?或者是用cast包起来看看? 06/06 00:50
2F:→ iFEELing: 碰 到 特 殊 字 元 要 另 外 标 记 啊 大 佬 06/06 06:39