White-Hat Posted July 10, 2014 Share Posted July 10, 2014 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 https://forums.phpfreaks.com/topic/289644-warning-mysql_fetch_array-expects-parameter-1-to-be-resource-boolean-given-in-homepathpublic_htmlpathpathstatsphp-on-line-41/ Share on other sites More sharing options...
requinix Posted July 10, 2014 Share Posted July 10, 2014 FAQ: mysql* expects parameter 1 to be resource, boolean given. Link to comment https://forums.phpfreaks.com/topic/289644-warning-mysql_fetch_array-expects-parameter-1-to-be-resource-boolean-given-in-homepathpublic_htmlpathpathstatsphp-on-line-41/#findComment-1484454 Share on other sites More sharing options...
trq Posted July 10, 2014 Share Posted July 10, 2014 That is seriously some of the worst code I've seen in a while. Could you try to make it any less efficient? Link to comment https://forums.phpfreaks.com/topic/289644-warning-mysql_fetch_array-expects-parameter-1-to-be-resource-boolean-given-in-homepathpublic_htmlpathpathstatsphp-on-line-41/#findComment-1484461 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.