2010-02-11 71 views
0

當我插入設標誌說:PHP MYSQL:插入 「+」 MYSQL中使用PHP

mysql_query("insert into table1 (title) values (\"date + book\")"); 

的 「+」 符號轉換爲空間。所以它成爲「日期     書」不是「日期+書」

我該怎麼做才能插入它,因爲它是。 但如果我直接查詢這MYSQL它接受它,因爲它是.. 請清除我的困惑..感謝

"UPDATE campus_bookinfo SET categoryid = ".$category.", bookversion = bookversion+1, 
iAmount = \"".str_replace(",","",$price)."\", lectureName = '".$tag."', eStatus = 3 WHERE idx_campus_bookinfo = ".$id_bookinfo; 
+0

@Treby:請發佈**原始**代碼。 – kennytm 2010-02-11 07:35:57

回答

1

嘗試這樣的:

mysql_query("insert into table1 (title) values ('date + book')") 

,或者如果它是一個變量:

mysql_query("insert into table1 (title) values ('$somevariable')") 
+0

我已經試過了,但這不起作用。我也試過\「因爲文本是從一個PHP變量,所以我連接到查詢文本 – Treby 2010-02-11 07:31:12

+0

請看我的更新 – 2010-02-11 07:37:32

+0

仍然不適合我。我張貼我的示例查詢字符串 – Treby 2010-02-11 07:49:04