I update the value in the sql table and then print the value, it still shows the old value.
<?
print_r(mysql_fetch_array(mysql_query("select visits from Orders")));
mysql_query("update Orders set visits=visits+1");
print_r(mysql_fetch_array(mysql_query("select visits from Orders")));
?>
It outputs 1, and then again 1. The second value should be 2. When I check in PhpMyAdmin it is 2, then why does it show Old value?
Please, help! Thanks in advance.
Regards, Mike
Edit:
This is the code that the OP tried to execute:
mysql_connect("localhost","mayankx_tt","111111");
mysql_select_db("mayankx_tt") or die(mysql_error());
print_r(mysql_fetch_array(mysql_query("select visits from Orders")));
mysql_query("update Orders set visits=visits+1");
print_r(mysql_fetch_array(mysql_query("select visits from Orders")));
And his conclusion:
Array ( [0] => 4 [visits] => 4 ) Array ( [0] => 4 [visits] => 4 )
source
share