william7neace Posted December 16, 2010 Share Posted December 16, 2010 hey guys i am putting missions on my game and i get this when i go to the missions link on my game... Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/darkshad/public_html/missions.php on line 17 This is my Missions.php <?phpsession_start();include "globals.php";$ir['level']=(int)($ir['level']);//-- Missions V2$error=("<b style='color:red;'>ERROR[/b]: ");print "<center><h3>Missions</h3>[b]You can start a mission now.[/b] </center>";$q=mysql_query("SELECT * FROM missions",$c);if(mysql_num_rows($q)== 0) { die($error."There is no missions currently set up."); }$q2=mysql_query("SELECT * FROM missions WHERE level < ".$ir['level']."",$c);print "<table width=100% border=0><tr><th>Mission Name</th><th>Mission Description</th><th>Level Required</th><th>Location Needed</th><th>Links</th></tr>";if(mysql_num_rows($q2)== 0){print "<tr><td colspan=5>There are no missions currently available.</td></tr>";}while($r2=mysql_fetch_array($q2)) { if($r2['location_on'] == 1) { $cnq=mysql_query("SELECT cityname FROM cities WHERE cityid=".$r2['location_value']."",$c);if($ir['location'] != $r2['location_value']) { $location="<font color=purple>[b]".mysql_result($cnq,0,0)."[/b]</font>"; $do="N/A"; } else { $location="<font color=red>[b]".mysql_result($cnq,0,0)."[/b]</font>"; $do="[url='startmission.php?ID=$r2[id]'][start][/url]"; } } else { $location="<font color=red>N/A</font>";$do="[url='startmission.php?ID=$r2[id]'][start][/url]"; }$q3=mysql_query("SELECT * FROM missdone WHERE user=".$ir['userid']." AND mission=".$r2['id']."",$c);if(mysql_num_rows($q3)) { $do="[i]Done[/i]"; }print "<tr><td>{$r2['name']}</td><td>{$r2['description']}</td><td>{$r2['level']}</td><td>$location</td><td>$do</td></tr>";}print "</table>";$h->endpage();?> Quote Link to comment Share on other sites More sharing options...
Dominion Posted December 16, 2010 Share Posted December 16, 2010 Post that page again or link us to the original post. Quote Link to comment Share on other sites More sharing options...
Curt Posted December 16, 2010 Share Posted December 16, 2010 hmm...first off I would suggest getting a very basic code editor as notepad sucks. See how all the code is on one line...thats the effect of the notepad i believe... I use a small program called PHP Editor 2.22..its free...i would suggest getting it or something similar... as for your error on line 17 ?...how can we know what line 17 is...lol Quote Link to comment Share on other sites More sharing options...
william7neace Posted December 16, 2010 Author Share Posted December 16, 2010 ok i am getting this on my Missions link Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/darkshad/public_html/missions.php on line 10 <?php session_start(); include "globals.php"; $ir['level']=(int)($ir['level']); //-- Missions V2 $error=("<b style='color:red;'>ERROR[/b]: "); print "<center><h3>Missions</h3> [b]You can start a mission now.[/b] </center>"; $q=mysql_query("SELECT * FROM missions",$c); if(mysql_num_rows($q)== 0) { die($error."There is no missions currently set up."); } $q2=mysql_query("SELECT * FROM missions WHERE level < ".$ir['level']."",$c); print "<table width=100% border=0><tr><th>Mission Name</th><th>Mission Description</th><th>Level Required</th><th>Location Needed</th><th>Links</th></tr>"; if(mysql_num_rows($q2)== 0) { print "<tr><td colspan=5>There are no missions currently available.</td></tr>"; } while($r2=mysql_fetch_array($q2)) { if($r2['location_on'] == 1) { $cnq=mysql_query("SELECT cityname FROM cities WHERE cityid=".$r2['location_value']."",$c); if($ir['location'] != $r2['location_value']) { $location="<font color=purple>[b]".mysql_result($cnq,0,0)."[/b]</font>"; $do="N/A"; } else { $location="<font color=red>[b]".mysql_result($cnq,0,0)."[/b]</font>"; $do="[url='startmission.php?ID=$r2[id]'][start][/url]"; } } else { $location="<font color=red>N/A</font>"; $do="[url='startmission.php?ID=$r2[id]'][start][/url]"; } $q3=mysql_query("SELECT * FROM missdone WHERE user=".$ir['userid']." AND mission=".$r2['id']."",$c); if(mysql_num_rows($q3)) { $do="[i]Done[/i]"; } print "<tr><td>{$r2['name']}</td><td>{$r2['description']}</td><td> {$r2['level']}</td><td>$location</td><td>$do</td></tr>"; } print "</table>"; $h->endpage(); ?> Quote Link to comment Share on other sites More sharing options...
Kieran-R Posted December 16, 2010 Share Posted December 16, 2010 Try this: <?php include "globals.php"; $ir['level']=(int)($ir['level']); //-- Missions V2 $error=("<b style='color:red;'>ERROR[/b]: "); print "<center><h3>Missions</h3> [b]You can start a mission now.[/b] </center>"; $q=mysql_query("SELECT * FROM missions"); if(mysql_num_rows($q)== 0) { die($error."There is no missions currently set up."); } $q2=mysql_query("SELECT * FROM missions WHERE level < ".$ir['level'].""); print "<table width=100% border=0><tr><th>Mission Name</th><th>Mission Description</th><th>Level Required</th><th>Location Needed</th><th>Links</th></tr>"; if(mysql_num_rows($q2)== 0) { print "<tr><td colspan=5>There are no missions currently available.</td></tr>"; } while($r2=mysql_fetch_array($q2)) { if($r2['location_on'] == 1) { $cnq=mysql_query("SELECT cityname FROM cities WHERE cityid=".$r2['location_value'].""); if($ir['location'] != $r2['location_value']) { $location="<font color=purple>[b]".mysql_result($cnq,0,0)."[/b]</font>"; $do="N/A"; } else { $location="<font color=red>[b]".mysql_result($cnq,0,0)."[/b]</font>"; $do="[url='startmission.php?ID=$r2[id]'][start][/url]"; } } else { $location="<font color=red>N/A</font>"; $do="[url='startmission.php?ID=$r2[id]'][start][/url]"; } $q3=mysql_query("SELECT * FROM missdone WHERE user=".$ir['userid']." AND mission=".$r2['id'].""); if(mysql_num_rows($q3)) { $do="[i]Done[/i]"; } print "<tr><td>{$r2['name']}</td><td>{$r2['description']}</td><td> {$r2['level']}</td><td>$location</td><td>$do</td></tr>"; } print "</table>"; $h->endpage(); ?> Quote Link to comment Share on other sites More sharing options...
william7neace Posted December 16, 2010 Author Share Posted December 16, 2010 I got this for you code Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/darkshad/public_html/missions.php on line 9 Quote Link to comment Share on other sites More sharing options...
Curt Posted December 17, 2010 Share Posted December 17, 2010 just taking a wild guess at your problem but did you make the missions table in your database ?....lol Quote Link to comment Share on other sites More sharing options...
Uridium Posted December 17, 2010 Share Posted December 17, 2010 try getting rid of the ,$c on your lines Quote Link to comment Share on other sites More sharing options...
Jordan Palmer Posted December 17, 2010 Share Posted December 17, 2010 try getting rid of the ,$c on your lines try getting rid of the ,$c on your linesRead the error back to yourself - It's telling them that it cannot report back from `missions`. Make sure you've added the database and selecting the right table Quote Link to comment Share on other sites More sharing options...
Djkanna Posted December 17, 2010 Share Posted December 17, 2010 Well the answer is pretty easy to find, here's a hint PHP's MySQL features have their own built in error system.... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.