Hello guys, i'm having an issue with updating the record in my database. everything seems to work well except that whenever i try updating the record via the mysql update procedure, it just returns with no errors and the record is not update. i tried echo'ing the $result to see if there was any messages and it just prints 1.
is there something wrong with my code? thanks in advance and appreciate all the help.
if(isset($_POST['action']) && $_POST['action'] == 'submitform')
{
$xid = $_POST['id'];
$xname = $_POST['name'];
$xmobile = $_POST['mobile'];
$xextra = $_POST['extra'];
$xip = $_SERVER['REMOTE_ADDR'];
$xdate = strftime("%Y-%m-%d %H:%M:%S");
$query_mobile = "SELECT mobile FROM $tbl_rec WHERE mobile = '$xmobile' LIMIT 1";
$result_mobile = mysql_query($query_mobile) or die(mysql_error());
if (mysql_num_rows($result_mobile)==0) {
mysql_select_db($db_name, $connection);
$insert_query = "UPDATE $tbl_rec SET mobile='".$xmobile."',name='".$xname."',extra='".$extra."',ip='".$xip."',date='".$xdate."' WHERE id='".$_POST['id']."'";
$result = mysql_query($insert_query, $connection) or die(mysql_error());
// header("location: userlist.php");
echo $result;
} else {
header("location: redirect.php");
}
}