Adema_It_Man
Adema_It_Man

Reputation: 39

How to update two fields in mysql using php via a input form

I believe I have a issue with in mysql query. Please take a look at the code and let me know if there is something wrong in this statement.

$sql = "UPDATE `Blog` SET `Employee_Name` = '$emp_name', 'Employee_Email' = '$emp_email'      WHERE `Blog`.`Id` = '$emp_id'";

Upvotes: 1

Views: 37

Answers (1)

Marc B
Marc B

Reputation: 360672

Bad quoting:

$sql = "UPDATE `Blog` SET `Employee_Name` = '$emp_name', 'Employee_Email' = '$emp_email'      
                                                         ^--------------^--- 

The indicated quotes should be backticks (`), not single quotes (').

And if you had proper (or any at all) proper error handling on your query calls, you'd have been told about the syntax error.

Upvotes: 1

Related Questions