July 23rd, 1999, 08:59 AM
-
How do i insert a row into mySQl from a form, if the inputs of the form contain a '? Don't single qoutes deliminate the array that is being added to the table?
for example-
How do i make this work?
INSERT INTO my_table VALUES('123', 'Jefferson's house')
------------------
July 25th, 1999, 01:59 PM
-
If your values are in stored in variables then you can just say $sql = "insert into table values ('$field1','$field2');" and then do a mysql_db_query($db, $sql).
chyrag.
July 26th, 1999, 06:39 AM
-
Um, no, you can't. The variables are not passed to mysql. Mysql has no idea what's in your php variables. php must pass the data in the variables to mysql and if there is a single quote it WILL send back an error. To prevent this you need to use addslashes().
$query="insert into $table values('addslashes($data)','addslashes($moredata)')";
[This message has been edited by rod k (edited 07-26-99).]
[This message has been edited by rod k (edited 07-26-99).]