Move from mysql to mysqli

Talk about working with different database types

Moderator: alexandrleonenko

webnail
Junior
Junior
Posts: 22
Joined: Oct 2nd, '10, 09:13

Move from mysql to mysqli

Postby webnail » Aug 26th, '15, 13:56

Hi admin,
PHP DataGrid Pro (AJAX enabled) version 6.1.1.
I am trying to change driver and move from mysql to mysqli, but it's not clear to me how is it possible.
What I actually tested is to change the connection vars from

$db_conn = DB::factory('mysql'); /* don't forget to change on appropriate db type */
$result_conn = $db_conn->connect(DB::parseDSN('mysql://'.$DB_USER.':'.$DB_PASS.'@'.$DB_HOST.'/'.$DB_NAME));
to
$db_conn = DB::factory('mysqli'); /* don't forget to change on appropriate db type */
$result_conn = $db_conn->connect(DB::parseDSN('mysqli://'.$DB_USER.':'.$DB_PASS.'@'.$DB_HOST.'/'.$DB_NAME));

but it didn't work.
Can you please advise? Which is the safe way to do it?
Thank a lot

administrator
Site Admin
Site Admin
Posts: 6009
Joined: Jan 7th, '09, 23:18
Contact:

Re: Move from mysql to mysqli

Postby administrator » Aug 26th, '15, 17:35

You may use or PDO or PEAR in this component. Mysqli is not a recognized driver in PDO.

webnail
Junior
Junior
Posts: 22
Joined: Oct 2nd, '10, 09:13

Re: Move from mysql to mysqli

Postby webnail » Aug 28th, '15, 13:36

Thanks Admin!
The question now is if I can do it with the version I use (6.1.1). Upgrading to V7 is a lot effort due to script customizations.
I read in the knowledge base that PDO is available in v7 and higher.

Can you give me an example of how can I connect to the Db using PEAR? All examples found in the KB concern newer versions...

Thanks
Vassilis


webnail
Junior
Junior
Posts: 22
Joined: Oct 2nd, '10, 09:13

Re: Move from mysql to mysqli

Postby webnail » Aug 31st, '15, 14:10

I have seen this post,
but it says somewhere that PEAR OR PDO are available on Versions 7.0.0 or higher... Can you please tell me if connection with mysqli is somehow available in the version 6.1.1 ?

pumpel
Newbie
Newbie
Posts: 3
Joined: Oct 23rd, '18, 08:18

Re: Move from mysql to mysqli

Postby pumpel » Oct 23rd, '18, 11:41

My conclution (so far) is that PHP 5.6 should STILL be running on the web-hotels.
Because there is still a PROBLEM connecting DATAGRID to a MYSQL-database (after PHP 5.6 was stopped and changed with PHP 7.2)
OR am I wrong?


Return to “Databases: different types implementation”