fetch() Not Working
I did use this wrapper to execute() a DELETE but cannot get a simple fetch() to work, I am supplying sample code below in case this is something I am missing on my end. If I change fetch() to fetch_first() it works just fine, but fetch() will connect and hang without reporting anything back.
The PHP Fatal error: Call to undefined method mysqli_result::fetch_all() in C:\Web\Intranet\htdocs\Building\common\class.database.php on line 462
<?php
require_once('common/config.php');
require_once('common/class.database.php');
$db = new Database($Sname, $Uname, $Pname, $Dname);
//////Check Connection/////////////
if (mysqli_connect_errno())
{
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
else
echo "<br>Connected<br>";
////////////////////////////////////
$array = $db->from('po_list')->fetch() ;
echo "<pre>";
print_r ($array);
echo "</pre>";
echo "Finished";
?>
Comments (4)
-
reporter -
repo owner mysqli_result::fetch_all() requires MySQL Native Driver (mysqlnd). I think your installation is missing the driver. What is the php and mysql version you are using ?
-
reporter Yes, my installation is old so probably causing a problem. I know MYSQLI was not fully supported until PHP Version 5.3 An upgrade is planned in several months.
PHP is 5.2.4 MySQL 5.0.45
-
repo owner - changed status to invalid
The mysqli extension was introduced with PHP version 5.0.0. The MySQL Native Driver was included in PHP version 5.3.0.
You need to update your php to 5.3 to make use of MySQLi completely. I'll however provide a note on the documentation about this.
- Log in to comment
Possible fix: Change line 462 to
What do you think?