millan Posted February 23, 2010 Share Posted February 23, 2010 Hi guys! Im getting this error dunno what it really wants tried to fix it but it aint working so hope you can help me. Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/realwars/domains/realwars.nl/public_html/crew/helpmenu1.php on line 17 php This are the codes Anticheat.php <?php require_once('auth.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Admin / Crew page - My Profile</title> <link href="loginmodule.css" rel="stylesheet" type="text/css" /> </head> <body> <h1>My Profile </h1> <?php require('header.php'); require('helpmenu1.php'); ?>php <b></b><br> <br> <br></p> </body> </html> addac1.php <?php require_once('auth.php'); echo "<head>"; echo "<title>Admin / Crew page - My Profile</title>"; echo "<link href=\"loginmodule.css\" rel=\"stylesheet\" type=\"text/css\" />"; echo "</head>"; echo "<body>"; echo "<h1>My Profile </h1>"; $dbconn = mysql_connect( "localhost", "user_site", "password"); mysql_select_db("realwars_site", $dbconn); require('header.php'); require('helpmenu1.php'); if (isset($_POST['action']) && $_POST['action'] == 'submitted') { $nickname = $_POST["nickname"]; mysql_query("UPDATE site_user SET isstaff = '2', staff = 'Member of the \'Anti-Cheat\' team', staffrang2 = 'Staff Position', description3 = 'Active helper, he assists the RW users and handles the abuse reports.' WHERE nickname = '$nickname'"); echo "<br><br><b>$nickname</b> has been added to the 'Anti-Cheat' team. From now on he can access the crew interface."; }else{ $dbconn = mysql_connect( "localhost", "user_site", "password"); mysql_select_db("realwars_site", $dbconn); $id3 = $_SESSION['SESS_MEMBER_ID']; $query2 = mysql_query("SELECT isstaff5,isstaff4,isstaff,isstaff2,isstaff3,isstaffleader2 FROM site_user WHERE userID='$id3'"); while ($list2 = mysql_fetch_object($query2)) { $isstaff5 = "$list2->isstaff5"; $isstaff4 = "$list2->isstaff4"; $isstaff = "$list2->isstaff"; $isstaff2 = "$list2->isstaff2"; $isstaff3 = "$list2->isstaff3"; $isstaffleader2 = "$list2->isstaffleader2"; if ($isstaff5 == 1 OR $isstaff4 == 1 OR $isstaffleader2 == 1){ echo "<table cellpadding=\"0\" cellspacing=\"0\">"; echo "<form method=\"post\">"; echo "<tr>"; echo "<td width=\"250\" class=\"border_down\"><br><b>Username</b><br></td>"; echo "<td width=\"250\" class=\"border_down\"><br><input type=\"text\" name=\"nickname\" value=\"\"><br></td>"; echo "</tr>"; echo "<tr>"; echo "<td><input type=\"hidden\" name=\"action\" value=\"submitted\"><input type=\"submit\" name=\"submit\" value=\" Submit \"></td>"; echo "</table>"; echo "</tr>"; echo "</form>"; } } } ?> delac1.php <?php require_once('auth.php'); echo "<head>"; echo "<title>Admin / Crew page - My Profile</title>"; echo "<link href=\"loginmodule.css\" rel=\"stylesheet\" type=\"text/css\" />"; echo "</head>"; echo "<body>"; echo "<h1>My Profile </h1>"; $dbconn = mysql_connect( "localhost", "users_site", "password"); mysql_select_db("realwars_site", $dbconn); require('header.php'); require('helpmenu1.php'); if (isset($_POST['action']) && $_POST['action'] == 'submitted') { $nickname = $_POST["nickname"]; mysql_query("UPDATE site_user SET isstaff2 = '0', staff = '', staffrang2 = '', description3 = '' WHERE nickname = '$nickname'"); echo "<br><br><b>$nickname</b> has been deleted from the 'Anti-Cheat' team. Staff access deleted."; }else{ $dbconn = mysql_connect( "localhost", "user_site", "password"); mysql_select_db("realwars_site", $dbconn); $id3 = $_SESSION['SESS_MEMBER_ID']; $query2 = mysql_query("SELECT isstaff5,isstaff4,isstaff,isstaff2,isstaff3,isstaffleader FROM site_user WHERE userID='$id3'"); while ($list2 = mysql_fetch_object($query2)) { $isstaff5 = "$list2->isstaff5"; $isstaff4 = "$list2->isstaff4"; $isstaff = "$list2->isstaff"; $isstaff2 = "$list2->isstaff2"; $isstaff3 = "$list2->isstaff3"; $isstaffleader2 = "$list2->isstaffleader2"; if ($isstaff5 == 1 OR $isstaff4 == 1 OR $isstaffleader2 == 1){ echo "<table cellpadding=\"0\" cellspacing=\"0\">"; echo "<form method=\"post\">"; echo "<tr>"; echo "<td width=\"250\" class=\"border_down\"><br><b>Username</b><br></td>"; echo "<td width=\"250\" class=\"border_down\"><br><input type=\"text\" name=\"nickname\" value=\"\"><br></td>"; echo "</tr>"; echo "<tr>"; echo "<td><input type=\"hidden\" name=\"action\" value=\"submitted\"><input type=\"submit\" name=\"submit\" value=\" Submit \"></td>"; echo "</table>"; echo "</tr>"; echo "</form>"; } } } ?> helpmenu1.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Admin / Crew page - My Profile</title> <link href="loginmodule.css" rel="stylesheet" type="text/css" /> </head> <body> <p><?php $dbconn = mysql_connect( "localhost", "user_site", "password"); mysql_select_db("realwars_site", $dbconn); $id3 = $_SESSION['SESS_MEMBER_ID']; $query2 = mysql_query("SELECT isstaff5,isstaff4,isstaff,isstaff2,isstaff3,isstaffleader2 FROM site_user WHERE userID='$id3'"); while ($list2 = mysql_fetch_object($query2)) { $isstaff5 = "$list2->isstaff5"; $isstaff4 = "$list2->isstaff4"; $isstaff = "$list2->isstaff"; $isstaff2 = "$list2->isstaff2"; $isstaff3 = "$list2->isstaff3"; $isstaffleader = "$list2->isstaffleader2"; echo "<tr>"; echo "<td><br><b><font color=\"red\">Suboptions: </font></b></b></td>"; if ($isstaffleader2 == 1){ echo "<td><b> | <a href=\"addac1.php\">Add Member</a></b></td>"; echo "<td><b> | <a href=\"delac1.php\">Del Member</a></b></td>"; } } ?> header.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Admin / Crew page - My Profile</title> <link href="loginmodule.css" rel="stylesheet" type="text/css" /> </head> <body> <p><?php $dbconn = mysql_connect( "localhost", "user_site", "password"); mysql_select_db("realwars_site", $dbconn); $id3 = $_SESSION['SESS_MEMBER_ID']; $query2 = mysql_query("SELECT isstaff5,isstaff4,isstaff,isstaff2,isstaff3 FROM site_user WHERE userID='$id3'"); while ($list2 = mysql_fetch_object($query2)) { $isstaff5 = "$list2->isstaff5"; $isstaff4 = "$list2->isstaff4"; $isstaff = "$list2->isstaff"; $isstaff2 = "$list2->isstaff2"; $isstaff3 = "$list2->isstaff3"; echo "<tr>"; echo "<td><b><font color=\"red\">Options: </font></b></td>"; if ($isstaff5 == 1 OR $isstaff4 == 1){ echo "<td><b><a href=\"administrator.php\">Administrator</a></b></td>"; } } if ($isstaff == 1){ echo "<td> |<b> <a href=\"helpsupport.php\">Help & Support</a></b></td>"; } if ($isstaff2 == 1){ echo "<td> |<b> <a href=\"anticheat.php\">Anti-Cheat</a></b></td>"; } if ($isstaff3 == 1){ echo "<td> | <b><a href=\"anticheat.php\">News Team</a></b></td>"; } echo "<td> | <b><a href=\"admin_crew.php\">Crew</a></b></td>"; echo "<td> | <b><a href=\"logout.php\">Logout</a></h6></b></td>"; echo "</tr>"; ?> Link to comment https://forums.phpfreaks.com/topic/193143-not-a-valid-mysql-resource/ Share on other sites More sharing options...
jl5501 Posted February 23, 2010 Share Posted February 23, 2010 You need to do more error checking on your connections and your query call to find out which is failing. It would seem most likely that you have an error in your sql Link to comment https://forums.phpfreaks.com/topic/193143-not-a-valid-mysql-resource/#findComment-1017088 Share on other sites More sharing options...
millan Posted February 23, 2010 Author Share Posted February 23, 2010 You need to do more error checking on your connections and your query call to find out which is failing. It would seem most likely that you have an error in your sql helpmenu1 is the one that fails everytime and it has something to do with "<?php" and } at the end.. ;/ Link to comment https://forums.phpfreaks.com/topic/193143-not-a-valid-mysql-resource/#findComment-1017094 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.