Jump to content

update problem


zmdlan

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/197321-update-problem/
Share on other sites

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");

 

?>

Link to comment
https://forums.phpfreaks.com/topic/197321-update-problem/#findComment-1035723
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/197321-update-problem/#findComment-1035727
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.