I have a problem with retrieving a value from a query. I know what the problem is but not sure how to solve it. Pretend I have this code:
$sql = mysql_query("SELECT * FROM sometable WHERE thisvalue = '$_SESSION["value"]'"); // This will always return one result.
$result = mysql_fetch_row($sql);
echo $result[1]; // This would be the column of 'firstvalue' which let's say is 5.
mysql_query("UPDATE sometable SET firstvalue = '10' WHERE thisvalue = '$_SESSION["value"]'"); // Now 'firstvalue' is 10.
if ($result[1] >= 10)
echo "True";
else
echo "False";
After running through the code, it returns "False" even though $result[1] is 10 and 10 >= 10 is true. It seems that any updated values does not take effect in the rest of the coding, so when the code goes through the if statement, it is thinking 5 >= 10 which would return false as it does since $result[1] was originally 5. How can I get the $result[1] value to update automatically in the rest of the coding once an update query has been sent?