I have numerous error checkers which the newly inputted code successfully meet the requirements of, however, the data doesnt seem to be going into the database. Its not updating, therefore i believe theres something wrong with my line of update code
"UPDATE user (user_username, user_first, user_last, user_email) VALUES ('$uname', '$first', '$last', '$email');";
Basically want the new information typed in my input boxes to be inserted into the database
3
Answers
You’re not using the MySQL syntax for inserting a new row:
INSERT INTO tblName (col1, col2, col3) VALUES (x, y, z);
You have the
UPDATE
keyword instead.For inserting data you query will be
But if you want to UPDATE your data, you need use the UPDATE clause correctly.
Building on @Tim’s answer, you should probably also use a prepared statement. The prepared statement will protect you from mysql injection, which could possibly destroy your database.
http://php.net/manual/en/pdo.prepared-statements.php