Jump to content
MakeWebGames

Help with missions mod


william7neace

Recommended Posts

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();?>
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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();
?>
Link to comment
Share on other sites

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();
?>
Link to comment
Share on other sites

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.   Paste as plain text instead

  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...