I just pushed something from my local machine to the live site and I get blank pages everywhere. I tracked down the problem to mysqli_fetch_all when I use that everything breaks
The function mysqli_fetch_all()
and its object oriented counterpart (mysqli_result::fetch_all)
are only available in PHP 5.3 and later.
It appears your server is running a lower version of PHP, or you're missing MySQL Native Driver (which this function depends on), which explains why the other fetch functions work and this doesn't.
From the Manual:
mysqli_fetch_all
mysqli_result::fetch_all
(PHP 5 >= 5.3.0)
For future debugging, turn errors on or refer to your error log because this will usually help to identify the problem.
error_reporting(E_ALL);
ini_set('display_errors', '1');
If you don't have access to upgrade the PHP version, or install MySQLND, you can simply convert the code to manually iterate using mysqli_fetch_assoc()
:
function getUserFields($connection){
$query = mysqli_query($connection, "DESCRIBE `adminUsers`");
$results = array();
if($query){
while($row = mysqli_fetch_assoc($query)){
$results[] = $row;
}
}
return $results;
}