Hello,
I want to edit record in mysql and ive got problem with UPDATE command its giving me syntex problem here is the code:
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("dbname", $con);
$sql="UPDATE users SET (userid, firstname, lastname, email, username, password, role) WHERE VALUES('$_POST[userid]','$_POST[firstname]','$_POST[lastname]','$_POST[email]','$_POST[username]','$_POST[password]','$_POST[role]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record edited";
header("Location: wyswietl.php");
mysql_close($con);
?>
Ive got form that i click to edit and when i want to update it ive got the error and here is the submit for if its going to be of any help:
echo $search_results .= "
<tr align=center bgcolor=Silver>
<th><font face=\"Tahoma\" size=\"1\">$row[userid]</b></font></th>
<th><font face=\"Tahoma\" size=\"1\">$row[firstname]</b></font></th>
<th><font face=\"Tahoma\" size=\"1\">$row[lastname]</b></font></th>
<th><font face=\"Tahoma\" size=\"1\">$row[email]</b></font></th>
<th><font face=\"Tahoma\" size=\"1\">$row[username]</b></font></th>
<th><font face=\"Tahoma\" size=\"1\">$row[password]</b></font></th>
<th><font face=\"Tahoma\" size=\"1\">$row[role]</b></font></th>
</font></td>
</tr>";
echo $search_results .= "<form action='update/update_user.php' method='post'>
ID: <input type='text' name='userid' size='50' value='$row[userid]'><br>
Imie: <input type='text' name='firstname' size='50' value='$row[firstname]'><br>
Nazwisko: <input type='text' name='lastname' size='50' value='$row[lastname]'><br>
Email: <input type='text' name='email' size='50' value='$row[email]'><br>
Nazwa Uzytkownika: <input type='text' name='username' size='50' value='$row[username]'><br>
Haslo: <input type='text' name='password' size='50' value='$row[password]'><br>
Uprawnienia: <input type='text' name='role' size='50' value='$row[role]'><br>
<input type='Submit'>
Thanks for help =]