如何將此[email protected]
插入到mysql數據庫中? 。如何在數據庫中插入用字符串連接的數字?
我試着把單引號括起來,沒有單引號,但兩種方法都失敗了。
// This is my query:
$n = [email protected];
$table = "invites";
if(!mysql_query("INSERT into $dbname.$table (accepted_by, accepted_on, phone, email, reffer)
VALUES('NULL', 'NULL', 'NULL', `$n`, 'NULL'")){
echo mysql_error();
}
這是表結構
accepted_by VARCHAR (50) NOT NULL
accepted_on VARCHAR (45) NOT NULL
phone VARCHAR (11) NULL
email VARCHAR (250) NULL
refferer CHAR (3) NOT NULL)
這是單引號括起來$ N錯誤消息:
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 2
我使用的MySQL版本5.0
請提供您已厭倦的疑問。 –
顯示你有什麼嘗試,所以我們可以看到 –
實際上單引號應該工作...什麼是你的表結構和查詢? –