This question already has an answer here:
I moved my code from test server to hostgator and I receive this error:
Fatal error: Call to undefined method mysqli_result::fetch_all()
I've coded so many lines with fetch_all that it will be quite tiresome to change it all.
What is the easiest way to get around this problem?
sample php:
function get_all_map_users() {
$mysqli = new mysqli(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME);
if ($mysqli->connect_error) {
//Failed to connect
die('Could not connect: ' . $mysqli->connect_error . ' - ' . $mysqli->connect_errno);
}
//Success
$result = $mysqli->query("SELECT * FROM names");
$rows = $result->fetch_all(MYSQLI_ASSOC);
//Clear result set
$result->free();
//End mysql query
//Close mysqli connection
$mysqli->close();
return $rows;
}
</div>
Enable PHP 5.3 on Hostgator: http://support.hostgator.com/articles/hosting-guide/hardware-software/php-5-3.