I am trying to stop 2 tables from being updated based on an update on the first table.
Here is what I have:
Code: Select all
//add user to pif_table//
$query = $db->getQuery(true);
$query="UPDATE `pif_table` SET $g = '$uname', @success = 1 WHERE $g IS NULL OR $g = '' AND id = '$id' ";
$db->setQuery($query);
$result = $db->execute();
I only wish the next 2 tables to be updated IF, $g column was empty and was updated above.
I receive a syntax error from the @success = 1 part of the command.
Code: Select all
if ($success == 1){
$query = $db->getQuery(true);
$query="UPDATE `jospk_users` SET tables = tables +1, payments = payments +1, tbl".$pifbase."= tbl".$pifbase." +1 WHERE id = '$uid'";
$db->setQuery($query);
$result = $db->execute();
$query = $db->getQuery(true);
$query = "INSERT INTO `pif_payments` (`table_num`, `r_1`, `r_2`, `r_3`, `r_4`, $g, `amount`) VALUES ('$id', '$r1', '$r2', '$r3', '$r4', '$uname', '$pifbase') ON DUPLICATE KEY UPDATE $g = '$uname'";
$db->setQuery($query);
$result = $db->execute();
}