Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysql support in php 7

Tags:

php

mysql

I have a huge product which was developed on php5.5, so the queries were written using mysql.

As PHP 7 & > has removed the support of mysql, now I am forced to use mysqli instead, but this will consume too much time for me.

Is there any temporary solution to make mysql queries work with PHP 7 for a while? As I am planing to migrate to mysqli but for mean while I need to make the code work with PHP 7 + mysql.

like image 379
StormTrooper Avatar asked Mar 09 '26 15:03

StormTrooper


1 Answers

You could recreate the mysql functions and use mysqli in these. This is not really clean, but it will work and is a fast solution until you can refactor your application

For example:

function mysql_connect($host, $username, $password, $db) {
    return mysqli_connect($host, $username, $password, $db);
}

function mysql_query($query){
    return $mysqli_query($query);
}
like image 82
Fels Avatar answered Mar 11 '26 06:03

Fels



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!