[英]mysql_query return an error, but not in phpmyadmin
它實際上不是我的第一個SQL查詢;),但是...!,我有一個奇怪的錯誤:我正在從CSV文件導入到我的數據庫,並且查詢返回mysql_query和phpmyadmin中 的錯誤 ,如果我復制/粘貼查詢,一切正常 。
$result = mysql_query ($ sql);
echo $ sql. "=>". $result. ','. Mysql_error ($this-> cnx). '<br> cnx ='. $this-> cnx. '<br>';
在回聲中:
INSERT INTO tiny_url (`id`, `url`, `tiny_url`, `page_rank`, `link_name`, `destination_url`, `anchor`, `active`) VALUES (NULL, "111", "222", 3, "444", "555", 1,1)
=>, 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 '
'At line 3
cnx = Resource id # 27
如果我這樣做:它的工作原理是:
$sql = 'INSERT INTO tiny_url (`id`, `url`, `tiny_url`, `page_rank`, `link_name`, `destination_url`, `anchor`, `active `) VALUES (NULL," 111 "," 222 ", 3," 444 "," 555 ", 1,1) ';
$result = mysql_query ($sql);
echo $sql. "=>". $result. ','. mysql_error($this-> cnx). '<br> cnx ='. $this-> cnx. '<br>';
你能幫我嗎?
晶圓廠
您的列稱為active
列(后跟一個空格)。
我發現了問題:在我的代碼中,我添加了這個
$sql .= ")<br>";
當然,查詢中不允許使用html代碼。
等等... :(
晶圓廠
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.