zmdlan Posted April 2, 2010 Share Posted April 2, 2010 Hello Recently I have developed a simple online instrument for our company. The problem is at a certain time when a user update his/her profile, it affected data in the whole table. For example when he/she update the password, his/her new password will replace/update all records in the table. Thanks in advance Quote Link to comment Share on other sites More sharing options...
Psycho Posted April 2, 2010 Share Posted April 2, 2010 Well, that sucks. Was there supposed to be a question in there, or perhaps some code for us to look at? Let's see the the block of code that does the update. Quote Link to comment Share on other sites More sharing options...
zmdlan Posted April 2, 2010 Author Share Posted April 2, 2010 here is the code <?php session_start(); include ('db_connect.php'); $_SESSION['kodsekolah']; $kodsekolah=$_SESSION['kodsekolah']; $password=$_POST['password']; $update_password = mysql_query ( "UPDATE login SET Password='$password' WHERE KodSekolah LIKE '%$kodsekolah%' "); header ("Location: utama.php"); ?> Quote Link to comment Share on other sites More sharing options...
Psycho Posted April 2, 2010 Share Posted April 2, 2010 Well, why are you using LIKE? If the value of $kodsekolah is something like just the letter 'a', then that query would update the password for ALL records containing the letter 'a' in that field. I have no idea what that value is supposed to represent. You also don't explain how that session value is set. But, that is most likely where the problem lies. By the way, what is this line for? $_SESSION['kodsekolah']; It won't do anything. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.