Jump to content
MakeWebGames

Recommended Posts

Posted (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 by KyleMassacre
code tags
Posted
$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?

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