Jump to content

mysql extension is deprecated


Recommended Posts

  • Premium

i got the following error at my ch-online status and my homepage:
 

Deprecated: mysql_query(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /var/customers/webs/xxx/xxx/inc/status.inc.php on line 30 Warning: mysql_query(): Access denied for user 'xxx'@'localhost' (using password: NO) in /var/customers/webs/xxx/xxx/inc/status.inc.php on line 30 Warning: mysql_query(): A link to the server could not be established in /var/customers/webs/xxx/xxx/inc/status.inc.php on line 30 Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /var/customers/webs/xxx/xxx/inc/status.inc.php on line 30 

status.inc.php is the following:

<div class="sidebar_middle_fix2">
<?php
    $ip = array("xxx","xxx","xxx");
    $portlist=array(21002, 3306, 21002); // Ports

    $ip1 = @fsockopen($ip[0], $portlist[0], $errno, $errstr, 1);
        if ($login_status) {
            echo '<div class="server_status on"><p>Channel 1</p>... ist online!</div>';
        } else {
            echo '<div class="server_status off"><p>Channel 1</p>... ist offline!</div>';
        }
    @fclose($login_status);
    
    $ip2 = @fsockopen($ip[1], $portlist[1], $errno, $errstr, 1);
        if ($db_status) {
            echo '<div class="server_status on"><p>Channel 2</p>... ist online!</div>';
        } else {
            echo '<div class="server_status off"><p>Channel 2</p>... ist offline!</div>';
        }
    @fclose($db_status);
    
    $pi3 = @fsockopen($ip[2], $portlist[2], $errno, $errstr, 1);
        if ($patch_status) {
            echo '<div class="server_status on"><p>Channel 3</p>... ist online!</div>';
        } else {
            echo '<div class="server_status off"><p>Channel 3</p>... ist offline!</div>';
        }
    @fclose($patch_status);

    $players_online_24 = mysql_fetch_object(mysql_query("SELECT COUNT(last_play) as count FROM player.player WHERE DATE_SUB(NOW(), INTERVAL 1 DAY) < last_play"))->count;
    if($players_online_24 > 0) {
        echo '<div class="server_status on"><p>Spieleranzahl</p>' . $players_online_24 . '</div>';
    }else{
        echo '<div class="server_status off"><p>Spieleranzahl</p>0</div>';
    }
?>
</div>

 

Looking for help please :(

Link to comment
Share on other sites

  • Bronze

If you want to turn off all deprecated warnings including them from mysql_* you have to add:

error_reporting(E_ALL ^ E_DEPRECATED);

in a global php file (config.php for example).

Attention: By updating your php version to 7 or higher, your mysql querys will not working anymore. So make sure to update your deprecated code before updating your system (in the future).

  • Love 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.