I have a function which counts the total of rows of data table. The problem is that this function is working well in localhost, but not in the server side.
In sever side it returns NULL all of the time which is not right.
I don't understand why it work in localhost but not in server(the same version of php)
this is the function:
function getTotal($mysqli, $table, $attribute, $val_id){
$result=mysqli_query($mysqli,"SELECT count(*) as total from $table WHERE $attribute='$val_id'");
$data=mysqli_fetch_assoc($result);
$total = $data['total'];
return $total;
}
$total_colis = getTotal($mysqli, '`colis_adr_euro`', 'id_client', $id_user);