So, when I run this code:
I get this error:
Any idea's what's wrong with that code?
I want it to find id 2 in table1 and insert into the row "comp1" the value "test1".
EDIT: Solution: using Update not INSERT INTO... IE, INSERT INTO table1 SET table1='value' WHERE id = 0.
PHP:
$sql = "INSERT INTO table1 (".$insertInto.") VALUES ('".$nm."') WHERE id = ".$id;
if (!mysql_query($sql, $con)) {
die("xgkzr ".mysql_error());
}
Code:
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 'WHERE id = '2'' at line 1
I want it to find id 2 in table1 and insert into the row "comp1" the value "test1".
EDIT: Solution: using Update not INSERT INTO... IE, INSERT INTO table1 SET table1='value' WHERE id = 0.