PHP/MySQL Question
Posted: Thu May 30, 2002 9:09 pm
Hey, I'm working on making a little "staff only" section of my site where the staff (aka members) can update their profile (i.e. username, password, etc) but for some reason I can't get the mysql UPDATE command to work. I'm a bit of a newbie so this might be a stupid question to most of you, but anyways. It keep telling me that the information was edited, but when I check the db nothing has changed.
Here's edit1.php:
Edit2.php:
Ok, this is probably completely wrong but I was just messing around with taking things out and adding things in, so feel free to edit as much code as needed to get this working. Thanks.
Here's edit1.php:
Code: Select all
<?
$db=mysql_connect("localhost","root","password");
mysql_select_db("staff",$db);
$login=mysql_query("select * from staff WHERE usrname='$loggedinїusr]' LIMIT 1", $db)
or die(mysql_error());
$rows=mysql_fetch_array($login);
?>
<form action="edit2.php" method="post">
UserName: <input type="text" name="username" value="<? echo $rowsїusrname] ?>">
<br>
Password: <input type="text" name="password" value="<? echo $rowsїpassword] ?>">
<br>
Real Name: <input type="text" name="rlname" value="<? echo $rowsїrlname] ?>">
<br>
E-Mail: <input type="text" name="email" value="<? echo $rowsїemail] ?>">
<br>
Location: <input type="text" name="location" value="<? echo $rowsїlocation] ?>">
<br>
<input type="hidden" name="oun" value="<? echo $rowsїusrname] ?>">
<input type="submit" name="submit" value="Edit Info">Code: Select all
<?
$db=mysql_connect("localhost","root","password");
mysql_select_db("staff",$db);
$login="UPDATE staff SET usrname='$username', password='$password', rlname='$rlname', email='$email', location='$location' where usrname='$_POSTїoun]'";
echo "Thank you, your information was successfully updated $usrname.";
?>