Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   TBDev (http://www.bvlist.com/forumdisplay.php?f=20)
-   -   Doesn't work with mysqli! (how to fix) (http://www.bvlist.com/showthread.php?t=11783)

BT-loader 12th October 2018 14:52

Doesn't work with mysqli! (how to fix)
 
Is there anyone who has go this to work with the forced use of mysqli?

DND 12th October 2018 14:53

simple.. change all your code to mysqli:coffee:

Napon 12th October 2018 15:45

OK pm me what code and all I can mysqli it for you


If you wait 2 weeks I'll be uploading my FMEDITION 18 mysqli to my github

Tedmorris 21st November 2018 21:59

Besides changing mysql_* calls to mysqli_* what are the functions that need to be updated etc. Ive seen some TBDEV mods with mysqli_* but cant seem to find any showing the updated functions related to the db like dbconn()

DND 21st November 2018 23:25

if you use standard tbdev.. this should do the trick


Code:

function dbconn($autoclean = false)
{
global $TBDEV;

if (!@($GLOBALS["___mysqli_ston"] = mysqli_connect($TBDEV['mysql_host'],  $TBDEV['mysql_user'],  $TBDEV['mysql_pass'])))
{
switch (((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_errno($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_errno()) ? $___mysqli_res : false)))
{
case 1040:
case 2002:
if ($_SERVER['REQUEST_METHOD'] == "GET")
die("

The server load is very high at the moment. Retrying, please wait...

");
else
die("Too many users. Please press the Refresh button in your browser to retry.");
default:
die("[" . ((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_errno($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_errno()) ? $___mysqli_res : false)) . "] dbconn: mysql_connect: " . ((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)));
}
}
((bool)mysqli_query($GLOBALS["___mysqli_ston"], "USE {$TBDEV['mysql_db']}"))
or die('dbconn: mysql_select_db: ' . ((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)));

userlogin();

if ($autoclean)
register_shutdown_function("autoclean");
}


Tedmorris 22nd November 2018 00:07

Thx DND, i use a heavy modified TBsource but that should do the trick, is there anything else that needs to be changed? And one last thing, i notice some calls are not changed in some code, how do i tell which ones to leave as mysql_* and which ones to change to mysqli_* ?

DND 22nd November 2018 00:27

Basic example:


Code:

mysql_query('SELECT username FROM users WHERE id = ' . sqlesc($user['invitedby']));
will become

Code:

mysqli_query($GLOBALS["___mysqli_ston"], 'SELECT username FROM users WHERE id = ' . sqlesc($user['invitedby']));

same query, just a bit changed

HDVinnie 23rd November 2018 05:06

Quote:

Originally Posted by Tedmorris (Post 52825)
Thx DND, i use a heavy modified TBsource but that should do the trick, is there anything else that needs to be changed? And one last thing, i notice some calls are not changed in some code, how do i tell which ones to leave as mysql_* and which ones to change to mysqli_* ?

Is this version on GitHub? Would make it easier to make a PR to show changes needed.

Tedmorris 24th November 2018 22:04

No mate its not but the orignal source would be. Whats a PR?

Napon 25th November 2018 01:28

mine is on github to mysqli


All times are GMT +2. The time now is 20:06.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.