|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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') ------------------ |
|
#2
|
|||
|
|||
|
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. |
|
#3
|
|||
|
|||
|
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).] |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > SINGLE QOUTES |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|