Samurai Legend Posted March 16, 2014 Share Posted March 16, 2014 (edited) Hello. I've been trying to create a new jail to go with my game. How ever the users do not show up on in jail? Any ideas why? Heres my code - <?php require('globals.php'); echo "<h3><u>Jail</u></h3>"; if(!isset($_GET['st'])) { $_GET['st'] = 0; } if(!$_GET['st']) { $_GET['st']=0; } $st=abs((int) $_GET['st']); $q=$db->query("SELECT `jail` FROM `users` WHERE `jail` > 0"); $membs=$db->num_rows($q); $pages=ceil($membs/25); for($i=1;$i<=$pages;$i++) { $s=($i-1)*25; if($s==$st) { echo "Pages: <strong>$i</strong> "; } else { echo "<a href='jail.php?&st=$s'>$i</a> "; } if($i % 25 == 0) { echo "<br />"; } } echo "<br /> <hr width='50%'>You take a trip down to the jail and take a look at the latest convicts.<hr width='50%'><br /> <hr width='85%'><table width='85%' class='table' border='0' cellspacing='1'><tr><th>Name</th><th>Level</th><th>Time</th><th>Reason</th><th>Bail</th> <th>Actions</th></tr>"; $q=$db->query("SELECT `u`.*, `c`.* FROM `users` AS `u` INNER JOIN `gangs` AS `c` ON `u`.`gang`=`c`.`gangID` WHERE `u`.`jail` > 0 ORDER BY `u`.`jail` DESC LIMIT $st, 25"); while($r=$db->fetch_row($q)) { $cost=25*$r['jail']*$r['level']; $cf=number_format($cost); $time=$r['jail']; $t4=floor($time/60/24); $t1=floor($time/60) % 24; $t2=$time % 60; if($t2 < 10) { $t3="0".$t2; } else { $t3=$t2; } if($t4) { $t5="$t4 days,"; } else { $t5=""; } if($t1) { $t1="$t1 hours,"; } else { $t1=""; } if($t2 == 1) { $t2="1 minute"; } else { $t2="$t2 minutes"; } print "\n<tr><td> <a href='viewuser.php?u={$r['userid']}'>{$r['username']}</a> [{$r['userid']}]</td><td>{$r['level']}</td><td>$t5 $t1 $t2</td><td>{$r['jail_reason']}</td><td>$$cf</td><td>[<a href='jailbust.php?ID={$r['userid']}'>Bust</a>] [<a href='jailbail.php?ID={$r['userid']}'>Bail</a>] [<a href='jailbribe.php'>Bribe</a>] [<a href='jailbreak.php'>Break</a>]</td></tr>"; } if($db->num_rows($q) == 0) { echo "<td colspan='6'>There is no one in jail!</td>"; } echo "</table><hr width='85%'><br /><hr width='50%'><a href='index.php'>> Go Home</a><hr width='50%'><br />"; $h->endpage(); ?> Edited March 16, 2014 by KyleMassacre code tags Quote Link to comment Share on other sites More sharing options...
Veramys Posted March 16, 2014 Share Posted March 16, 2014 $q=$db->query("SELECT `u`.*, `c`.* FROM `users` AS `u` INNER JOIN `gangs` AS `c` ON `u`.`gang`=`c`.`gangID` WHERE `u`.`jail` = 0 ORDER BY `u`.`jail` DESC LIMIT $st, 25"); Why do you have it selecting where jail=0? Quote Link to comment Share on other sites More sharing options...
Samurai Legend Posted March 16, 2014 Author Share Posted March 16, 2014 Oh that's when I was trying to fix the error xD But still didn't work when I change it to jail > 0 Quote Link to comment Share on other sites More sharing options...
Veramys Posted March 16, 2014 Share Posted March 16, 2014 You also have two $q= in your code. Quote Link to comment Share on other sites More sharing options...
Samurai Legend Posted March 16, 2014 Author Share Posted March 16, 2014 Still don't work..? - - - Updated - - - I fixed it. I changed INNER JOIN to LEFT JOIN! Thanks all for helping :) Quote Link to comment Share on other sites More sharing options...
Veramys Posted March 16, 2014 Share Posted March 16, 2014 Tested it out on my server and INNER JOIN works perfectly on mine.. And you need to fix you bust file. Quote Link to comment Share on other sites More sharing options...
Samurai Legend Posted March 16, 2014 Author Share Posted March 16, 2014 (edited) I don't really know why it's playing on my server. I'll get the bust file fixed asap! Jail Bust fixed. Edited March 16, 2014 by Samurai Legend Quote Link to comment Share on other sites More sharing options...
Veramys Posted March 16, 2014 Share Posted March 16, 2014 I also can't send you a mail on there. 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.