How can I update two unrelated mysql tables with a php script? I use something like this. If i use two different $sql statements like $sql1 $sql2 its not working.
// mysql update row with matched pid
$result1 = mysql_query("UPDATE users SET users.p = users.p - '$p', users.n = users.n -'$n' WHERE users.uid = $uid");
$result2 = mysql_query("UPDATE names SET names.p = names.p + '$p', names.n = names.n + '$n' WHERE names.p_id = $p_id");
// check if row inserted or not
if ($result1 && $result2)
{
// successfully updated
$response["success"] = 1;
$response["message"] = "successfully updated.";
// echoing JSON response
echo json_encode($response);
}