Thread: function dbconn
View Single Post
  #2  
Old 30th April 2021, 00:52
darkalchemy darkalchemy is offline
Administrator
 
Join Date: Dec 2017
United States
Posts: 101
Default
Without doing the rewrite for you, start by changing mysql to mysqli, in the code.

The connection signature changes to this:
Code:
mysqli_connect($mysql_host, $mysql_user, $mysql_pass, $mysql_db);
Also, I would move these to you mysql.conf file, it will save you 3 queries with every connection.
Code:
mysql_query("SET NAMES UTF8");
mysql_query("SET collation_connection = 'utf8_general_ci'");
mysql_query("SET sql_mode=''");
and you can remove this, as it's now part of the connection signature, saving another query with every connection.
Code:
mysql_select_db($mysql_db) or die('dbconn: mysql_select_db: ' + mysql_error());
Also, you will need to pass the database connection to mysqli_query like:
Code:
mysqli_query($db, $query);
You can make the $db connection a global or fetch it as needed.
Reply With Quote