s*****r 发帖数: 59 | 1 mysql_select_db(INQUIRY_DB);
$insert = "INSERT INTO profiles
set INQEmail=\"$lname\"";
$result = mysql_query($insert);
I use mysql in php code. but whenever I tried to add a new entry into the
table, I always failed. can somebody give me some suggestion why that happen?
this is a test. the table include a lot of columns, I tried to add a new entry
with only one column value. thanks very much! |
|
P****y 发帖数: 707 | 2 mysql_select_db("INQUIRY_DB");
$insert = "INSERT INTO profiles (INQEmail) VALUES ('$lname')"; |
|
s*****r 发帖数: 59 | 3 $insert = "INSERT INTO profiles
(INQLast_Name,INQEmail) values ('$lname,$lname')";
failed, is that the correct syntax when adding more column values? thanks.
if I add a single value, it works good, but when I tried to add mutiple, it
failed. thanks.
happen?
entry |
|
c******e 发帖数: 1581 | 4 slipper, you need a little more bit study on php and mysql.
The correct syntax should be:
$insert = "INSERT INTO profiles (INQLast_Name, INQEmail) values
('".addslashes($lname)."','".addslashes($lname)"')";
Note single quote is around each varchar field.
the |
|
s*****r 发帖数: 59 | 5 mysql_select_db(INQUIRY_DB);
$insert = "INSERT INTO profiles
set INQEmail=\"$lname\"";
$result = mysql_query($insert);
I use mysql in php code. but whenever I tried to add a new entry into the
table, I always failed. can somebody give me some suggestion why that happen?
this is a test. the table include a lot of columns, I tried to add a new entry
with only one column value. thanks very much! |
|
s*****r 发帖数: 59 | 6 $insert = "INSERT INTO profiles
(INQLast_Name,INQEmail) values ('$lname,$lname')";
failed, is that the correct syntax when adding more column values? thanks.
if I add a single value, it works good, but when I tried to add mutiple, it
failed. thanks.
the |
|
aw 发帖数: 127 | 7 FT,你INSERT到2个COLUMN,INQLast_Name,INQEmail,怎么用一个值'$lname,$lname'?(
应该是‘$lname’,‘$lname')
new |
|