Edit: Now fixed! Thank you for your help!
Sorry for the beginner questions, I’m creating a simple page to edit another page for my teams website.
This is the code I’m using, but it’s not updating the database.
Incorrect code:
mysql_query("UPDATE pages SET `pagename` = $pagename, `pagedesc` = $pagedesc,
`agekey` = $pagekey, `pagecont` = $pagecont WHERE `pages_id` = $pages_id") or die(mysql_error());
Correct code:
mysql_query("UPDATE pages SET pagename = '$pagename', pagedesc = '$pagedesc', pagekey = '$pagekey', pagecont = '$pagecont' WHERE pages_id = $pages_id") or die(mysql_error());
Using “ did not work at all. But adding or die(mysql_error()); to my query helped. I should have thought of that first! 🙂
Isn’t your mysql query should be
instead of
You were using ‘ (Single quote) in field name. single quote is used when the data is of type varchar
e.g. If table have field as myField02 varchar2(20), then while inserting query will be
If the field are not varchar then don’t use single quote