For my following sql update query I need to get the number of affected rows. With $mysqli->affected_rows, I am getting 0 rows affected but while I check database, data are being updated. I ran the same query from phpMyAdmin which returns the number of affected as expected but my PHP is returning just 0; Any idea where I messed up?
print_r($sql);
// $sql= UPDATE `f`.`air_pax` SET `pax_type`='SRC' , `pax_name`='PAUL/SATTYAJ MSTR(CHD/05NOV04)' , `fare`='198' , `c_discount`='1' , `c_charge`='30' , `tax`='20' , `invoice`='247' , `v_invoice`='ghi' , `gross_fare`='150' , `commission`='10' , `v_charge`='50' , `apc`='1' , `t_charge`='5' , `remarks`='rem 3' , `cost_per_pass`='212.5' WHERE `air_pax`.`serial`='5' LIMIT 1
if($result = $mysqli->query($sql)){
var_dump($mysqli->affected_rows); // this returns 'int 0'
if($mysqli->affected_rows == 1){
return TRUE;
} else{
return FALSE;
}
}
I know that if no changes are there, then number of affected rows will be 0;
My [SERVER_SOFTWARE] => Apache/2.4.9 (Win32) PHP/5.5.12
.