Tonka Posted June 13, 2008 Share Posted June 13, 2008 I'm having some problems with my battle tent, it's only displaying 1 bot <?php include "globals.php"; if($ir['jail'] or $ir['hospital']) { echo("This page cannot be accessed while in jail or hospital."); $h->endpage(); exit; } print "<h3>Battle Tent</h3> [b]Welcome to the battle tent! Here you can challenge bot's for money.[/b] <table width='95%' cellspacing='1' class='table'><tr><th>Bot Name</th><th>Level</th><th>Times Beaten</th><th>Ready To Be Challenged?</th><th>Location</th><th>Money Won</th><th>Challenge</th></tr>"; $q=$db->query("SELECT cb.*,u.*,c.npcid,cy.cityname FROM challengebots cb LEFT JOIN users u ON cb.cb_npcid=u.userid LEFT JOIN challengesbeaten c ON c.npcid=u.userid AND c.userid=$userid LEFT JOIN cities cy ON u.location=cy.cityid"); while($r=$db->fetch_row($q)) { $earn=$r['cb_money']; $v=$r['userid']; $q=$db->query("SELECT count(*) FROM challengesbeaten WHERE npcid=$v"); $times=$db->fetch_single($q); print "<tr><td align='center'>{$r['username']}</td><td align='center'>{$r['level']}</td><td align='center'>$times</td><td align='center'>"; if($r['hp'] >= $r['maxhp']/2 and $r['location']==$ir['location']) { print "<font color=green>Yes</font>"; } else { print "<font color=red>No</font>"; } print "</td><td align='center'>{$r['cityname']}</td><td align='center'>\$".money_formatter($earn,'')."</td><td align='center'>"; if($r['npcid']) { print "[i]Already[/i]"; } else { print "[url='attack.php?ID={$r[']Challenge[/url]"; } print "</td></tr>"; } print "</table>"; $h->endpage(); ?> Quote Link to comment Share on other sites More sharing options...
ShizzleNizzle Posted June 13, 2008 Share Posted June 13, 2008 Re: Battle tent FIND: $q2=$db->query("SELECT count(*) FROM challengesbeaten WHERE npcid=$v"); $times=$db->fetch_single($q2); REPLACE: $q2=$db->query("SELECT count(*) FROM challengesbeaten WHERE npcid=$userid"); $times=$db->fetch_single($q2); That Should work Quote Link to comment Share on other sites More sharing options...
Tonka Posted June 15, 2008 Author Share Posted June 15, 2008 Re: Battle tent thx, worked perfectly 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.