I am with Confuse with Condition ..
global $db;
$sql = " SELECT * FROM TEST";
$dbc = mysqli_query($db,$sql)
if (!$sql || mysqli_num_rows($dbc) == 0) {
// rollback - Transaction
}
or
if (!$sql && mysqli_num_rows($dbc) == 0){
// rollback - Transaction
}
should i use (!$sql || mysqli_num_rows($dbc) == 0) OR (!$sql && mysqli_num_rows($dbc) == 0)
AS if $sql is true and mysqli_num_rows($dbc) == 0 ( false )
then too condition is False (roll-backed)
AND if $sql is false and mysqli_num_rows($dbc) == 4 ( true )
then too condition is False (roll-backed)
and if both are false then too roll-backed ..
similarly for :
$resultupdate = " UPDATE TEST SET A="NO" WHERE sid="check" ;
if((!$resultupdate) || (mysqli_affected_rows($db) == 0)) {
// rollback - Transaction
}
or
if((!$resultupdate) && (mysqli_affected_rows($db) == 0)){
// rollback - Transaction
}