Im trying to update my tables using this query. Once I hit 'update' im redirected to the view all page and all values remains the same. No change takes place but Not getting an error either. Please Help!
$sql = "UPDATE myaddressbook.contacts SET (firstName,lastName,nickName,cellNumber,homeNumber,workNumber) VALUES ('$firstName','$lastName','$nickName','$cellNumber','$homeNumber','$workNumber') " ; "UPDATE address SET(street,city,state,country) VALUES('$street','$city','$state','$country')"; "UPDATE contacts SET (email,birthday,memo) VALUES ('$email','$birthday','$memo') id = '{$_REQUEST['id']}'";
Your queries are little bit off. Update queries use UPDATE [table] SET [column] = [value], [column] = [value] ... WHERE [condition], [condition] ...
syntax, and it looks like you've confused that with INSERT syntax, which is INSERT INTO [table] ([column], [column], ...) VALUES ([value], [value], ...);
Try the following (hopefully it gives you a good idea of how to rewrite it):
UPDATE myaddressbook.contacts
SET firstName = '$firstName', lastName = '$lastName', ...
WHERE id = '$_REQUEST["id"]'
UPDATE does not use VALUES -- it should be formed like this...
UPDATE your_table_name SET your_field='your_value' WHERE ID='the_myself_id'
(where ID = is a unique identifier column for the table)