Deprecated: mysql_connect()

前端 未结 15 1105
醉酒成梦
醉酒成梦 2020-11-22 06:55

I am getting this warning, but the program still runs correctly.

The MySQL code is showing me a message in PHP:

Deprecated: mysql_connect(): T

15条回答
  •  不思量自难忘°
    2020-11-22 07:59

    Well, i just faced such message today when i moved to new hosting! anyway i have tried to change the "mySQL" to "mySQLi" but not working, so i have done this:

    A MySQL error has occurred.

    Your Query: " . $connect_myconn . "
    Error Number: (" . mysql_errno() . ")

    " . mysql_error()); mysql_select_db($database_myconn, $myconn); ?>

    The trick is to set error reporting off :)

    # Turn off all error reporting
    error_reporting(0);
    

    For PHP 7+ you can use this code instead:

    ini_set('display_errors', 0);
    ini_set('log_errors', 1);
    

    Thanks

提交回复
热议问题