I'm trying to update a row in a table using PHP, although I'm this is not my first time, but the update function is not working.
This is the php code:
<?php
header("Access-Control-Allow-Origin: *");
$server = "localhost";
$username = "username";
$password = "dbpass";
$database = "dbname";
$con = mysql_connect($server, $username, $password) or die ("Could not connect: " . mysql_error());
mysql_select_db($database, $con);
$q=mysqli_query("UPDATE `phonegap_login` SET `firstname` = 'Alhia' WHERE `reg_id` =50;");
if($q)
{
echo "success";
}
else
{
echo "failed";
}
?>
And by the way, if you try INSERT into, it will work:
$q=mysql_query("insert into `phonegap_login` (`reg_date`, `firstname`, `lastname`, `email`, `password`) values ('test', 'test', 'test', 'test', 'test')");
How do I fix it? the insert is working, updating a row is not. I'm using a row with reg_id=50 for testing.