I want to update mysql table pin if Pin field value is the same as the user input pin.In this case, I want to update appid field in the pin table once the the select query retur
I think you should add one more field
like: number_update
into your pin
table first. Default value is 0
First time update, it will have value is 1
and you could check that value,
if it is 1
, will alert ID Already in Use, Pls login
. If it is 0
, allow to update
$result = mysql_query("SELECT * FROM pin WHERE Pin = '$Pin'");
$test = array();
while ($row = mysql_fetch_array($result)) {
$test[] = array_map('utf8_encode', $row);
}
if($test["number_update"] == 1) { //Checking already updated
//Notify user that they have already updated
} else {
mysql_query("UPDATE pin SET appid ='$num' WHERE Pin= '$Pin'")
or die(mysql_error());
}