ADOdb / ADOdb

ADOdb is a PHP database class library that provides powerful abstractions for performing queries and managing databases. ADOdb also hides the differences between DB engines so you can easily switch them without changing your code.
https://adodb.org/
Other
428 stars 270 forks source link

mysqli_query() expects parameter 1 to be mysqli #457

Closed sido420 closed 6 years ago

sido420 commented 6 years ago

I'm trying to upgrade an existing web app from PHP 5.x to 7.2.10 and ADOdb-5.20.12.

I'm getting the following error message:

mysqli_query() expects parameter 1 to be mysqli, boolean given in /../libraries/ADOdb-5.20.12/drivers/adodb-mysqli.inc.php on line 788

mysqli is enabled in config and I've double checked using phpinfo().

Also, getting similar error on

mysqli_error() expects exactly 1 parameter, 0 given in /../site/index.php on line 64

Here is the code that connects to MySQL:

        $db                     =       adoNewConnection('mysqli');
        $db->debug              =       true;
        $db->connect    (       $adodb_server, $adodb_user, 
                                $adodb_password, $adodb_database);
        $ADODB_FETCH_MODE       =       ADODB_FETCH_ASSOC;
        $ADODB_CACHE_DIR        =       $root."cache";
        $db->cacheSecs          =       3600;           // 1 Hour
sido420 commented 6 years ago

I'm getting the following on web page, however the $db object appears to be a valid connection object (did var_dump on it):

Could not connect : 
127.0.0.1: MySQL server has gone away
object(ADODB_mysqli)#1 (91) { ["databaseType"]=> string(6) "mysqli" ["dataProvider"]=> string(5) "mysql" ["hasInsertID"]=> bool(true) ["hasAffectedRows"]=> bool(true) ...
sido420 commented 6 years ago

Turns out MySQL 8 was the culprit with many new changes needed for connection.