rubo77/php-mysql-fix

Will this work with PHP 8.0?

tblazek opened this issue · 8 comments

Thanks for the great work on this! Just wondering if it will still work with PHP 8.0

I think it could, try it out and please report your result here ;)

rkbi commented

Recently I inherited some code only to add some features, so I can not upgrade to PDO. Found this awesome repo, so tried to run the project in my local environment with php 8, but got some errors. Any suggestion would be much appreciated.

My environment -
XAMPP under Linux
PHP Version 8.0.13
MariaDB - 10.4.22-MariaDB

Error producing (I replaced the actual directory path) -

Fatal error: Uncaught TypeError: mysqli_query(): Argument #1 ($mysql) must be of type mysqli, bool given in /temp/fix_mysql.inc.php:81 Stack trace: #0 /temp/fix_mysql.inc.php(81): mysqli_query(false, 'SET character_s...') #1 /connect.php(8): mysql_query('SET character_s...', false) #2 /index.php(6): include('/mnt/mxlinux/op...') #3 {main} thrown in /temp/fix_mysql.inc.php on line 81

The first querie is -

$c = @mysql_connect("localhost",, );
mysql_query("SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'", $c);

Cheers.

th query is not your problem, but it seems like the database-connection variable is not corrrectly set.

Do you include the script inside another class?

We would need more of your code, to help you.

remove the @ sign before the connection command, that suppresses error messages

tengo el mismo problema, me sale este mensaje de error:

Fatal error: Uncaught TypeError: mysqli_query(): Argument #1 ($mysql) must be of type mysqli, null given in C:\xampp8.1\htdocs\siste_nuevomun\sistema\comunes\fix_mysql.inc.php:81 Stack trace: #0 C:\xampp8.1\htdocs\siste_nuevomun\sistema\comunes\fix_mysql.inc.php(81): mysqli_query(NULL, 'select borrado ...') #1 C:\xampp8.1\htdocs\siste_nuevomun\sistema\prueba.php(5): mysql_query('select borrado ...') #2 {main} thrown in C:\xampp8.1\htdocs\siste_nuevomun\sistema\comunes\fix_mysql.inc.php on line 81