Forum Moderators: coopster
I know this is a very simple question, that how can i update my database to MYSQL? I would like to update certain user and user ID into certain collumns. Is my syntax correct? Thanks for looking it for me here is my code:
Login Table:
"User","userid"
"John","jon"
Php code:
<?.....
$query = "UPDATE Login SET User=$user,userid=$userid WHERE User,userid";
mysql_query($query);
?>
The WHERE clause is only to tell the db which reference it is so it knows which row to apply the update to.
HTH
.... or better store it in a session. The user will have generally less chance of abusing the system with a session than with the hidden field.
Not sure if the OP left it out for brevity, but the code didn't include anything for verifying that the person changing the information is actually that person. And just putting the usernname in a hidden field wouldn't prevent a hacker from making a similar form on his own site and POSTing the information with whatever username he wanted.