Jump to content
MakeWebGames

Hospital/Jail Count stuck


illegalife
 Share

Recommended Posts

Re: Hospital/Jail Count stuck

SELECT COUNT(hospital) as in_hospital FROM users WHERE hospital>0

and basicly the same to jail

SELECT COUNT(jail) as in_jail FROM users WHERE jail>0

and call it using $var['in_hospital'] or $var['in_jail']

where $var would be the name for the given query

Link to comment
Share on other sites

Re: Hospital/Jail Count stuck

Hospital

<?php
include "globals.php";
print "[img=hosp.gif]

<table width='75%' class=\"table\" border=\"0\" cellspacing=\"1\"><tr bgcolor=gray><th>Name</th> <th>Level</th> <th>Time</th><th>Reason</th></tr>";
$q=$db->query("SELECT u.*,c.* FROM users u LEFT JOIN gangs c ON u.gang=c.gangID WHERE u.hospital > 0 ORDER BY u.hospital DESC",$c);
while($r=$db->fetch_row($q))
{
print "\n<tr><td>{$r['gangPREFIX']} [url='viewuser.php?u={$r[']{$r['username']}[/url] [{$r['userid']}]</td><td align=center>
{$r['level']}</td><td align=center>{$r['hospital']} minutes</td><td>{$r['hospreason']}</td></tr>";
}
print "</table>";
$h->endpage();
?>

 

Jail

<?php
include "globals.php";
echo "[img=jail.gif]";
if($ir['jail'])
{
	echo "

[url='addoffer.php']> Make Bust Offer[/url]

";
}
echo "
<table width='85%' class=\"table\" border=\"0\" cellspacing=\"1\"><th>Name</th> <th>Level</th> <th>Time</th><th>Reason</th> <th> Bust Offer</th> <th>Actions</th></tr>";
$q=$db->query("SELECT u.*,c.* FROM users u LEFT JOIN gangs c ON u.gang=c.gangID WHERE u.jail > 0 ORDER BY u.jail DESC");
while($r=$db->fetch_row($q))
{
print "\n<tr><td background=images/th.png>{$r['gangPREFIX']} [url='viewuser.php?u={$r[']{$r['username']}[/url] [{$r['userid']}]</td><td align=center>{$r['level']}</td><td align=center>{$r['jail']} minutes</td><td>{$r['jail_reason']}</td><td>\$".number_format($r['jail_offer'])."</td><td align=center background=images/thgreen.png>[url='jailbust.php?ID={$r['][i][b]<font color='green'>Bust[/b][/i]</font>[/url]</td></tr>";
}
print "</table>
";
if($ir['jail'] || $ir['user_level']==2)
{include_once("jailshout.php");}
print"

";
$h->endpage();
?>

 

<?php
global $db,$c,$ir, $set;
$hc=$set['hospital_count'];
$jc=$set['jail_count'];
$ec=$ir['new_events'];
$mc=$ir['new_mail'];
$zerko=0;
if($ir['hospital'])
{
 print "[url='hospital.php']Hospital ($hc)[/url]

 [url='inventory.php']Inventory[/url]
";
}
elseif($ir['jail'])
{
 print "[url='jail.php']Jail ($jc)[/url]
";
}
else
{
 print "[url='index.php']Home[/url]

 [url='inventory.php']Items[/url]
";
}
if($ec > 0) { print "[url='events.php']Events ($ec)[/url]
"; }
else { print "[url='events.php']Events (0)[/url]
"; }
if($mc > 0) { print "[url='mailbox.php']Mailbox ($mc)[/url]
"; }
else { print "[url='mailbox.php']Mailbox (0)[/url]
"; }
if($ir['jail'] and !$ir['hospital'])
{
 print "[url='gym.php']Jail Gym[/url]

 [url='hospital.php']Hospital ($hc)[/url]
";
}
else if (!$ir['hospital'] && (!$ir['drunktank'] > $zerko))
{
 print "[url='explore.php']City[/url]

 [url='gym.php']Gym[/url]

 [url='criminal.php']Crimes[/url]

 [url='job.php']Your Job[/url]

 [url='bar.php']Bar[/url]

 [url='education.php']Education[/url]

 [url='hospital.php']Hospital ($hc)[/url]

 [url='jail.php']Jail ($jc)[/url]
";
} else {
 print "[url='jail.php']Jail ($jc)[/url]
";
}
print "[url='forums.php']Forums[/url]
";
if($ir['new_announcements'])
{
print "[url='announcements.php']News ({$ir['new_announcements']})[/url]
";
}
else
{
print "[url='announcements.php']News (0)[/url]
";
}
print "
[url='halloffame.php']Hall of Fame[/url]

[url='search.php']Search[/url]
";
if(!$ir['jail'] && $ir['gang'])
{
 print "[url='yourgang.php']Your Gang[/url]
";
}
if($ir['user_level'] > 1)
{
print "<hr />
[url='staff.php']Staff Panel[/url]
\n";



print "<hr />[b]Staff Online:[/b]
";
$q=$db->query("SELECT * FROM users WHERE laston>(unix_timestamp()-15*60) AND user_level>1 ORDER BY userid ASC");
while($r=$db->fetch_row($q))
{
$la=time()-$r['laston'];
$unit="secs";
if($la >= 60)
{
$la=(int) ($la/60);
$unit="mins";
}
if($la >= 60)
{
$la=(int) ($la/60);
$unit="hours";
if($la >= 24)
{
$la=(int) ($la/24);
$unit="days";
}
}
print "[url='viewuser.php?u={$r[']{$r['username']}[/url] ($la $unit)
";
}
}
if($ir['donatordays'])
{
print "<hr />
[b]Donators Only[/b]

[url='cgym.php']Point Gym[/url]

[url='friendslist.php']Friends List[/url]

[url='blacklist.php']Black List[/url]";
}
print "<hr />
[url='preferences.php']Preferences[/url]

[url='preport.php']Player Report[/url]

[url='helptutorial.php']Help Tutorial[/url]

[url='gamerules.php']Game Rules[/url]

[url='viewuser.php?u={$ir[']My Profile[/url]

[url='logout.php']Logout[/url]


Time is now

";
echo date ('F j, Y')."
".date('g:i:s a');

?>
Link to comment
Share on other sites

Re: Hospital/Jail Count stuck

 

$blah=mysql_fetch_array(mysql_query("SELECT COUNT(hospital) as in_hospital FROM users WHERE hospital>0",$c));
$bla=mysql_fetch_array(mysql_query("SELECT COUNT(jail) as in_jail FROM users WHERE jail>0",$c));
$hc=$blah['in_hospital'];
$jc=$bla['in_jail'];
Link to comment
Share on other sites

Re: Hospital/Jail Count stuck

minute cron will be better.......if you use that query. You will be submiting it everytime you click a page....every user will be submiting every time they click a page...that alot of runnnig...

And yes. its in your cron_minute.php

$hc=$db->num_rows($db->query("SELECT * FROM users WHERE hospital > 0"));

$jc=$db->num_rows($db->query("SELECT * FROM users WHERE jail > 0"));

thats the original.

better to use..

$hc=$db->num_rows($db->query("SELECT userid FROM users WHERE hospital > 0"));

$jc=$db->num_rows($db->query("SELECT userid FROM users WHERE jail > 0"));

But if your on free host your screwed.

Link to comment
Share on other sites

Re: Hospital/Jail Count stuck

 

$hc=$db->num_rows($db->query("SELECT userid FROM users WHERE hospital > 0"));

$jc=$db->num_rows($db->query("SELECT userid FROM users WHERE jail > 0"));

 

benchmarking... not the best option... giving full done code to users that don't seem to want to learn... your is definetly the best way. ;)

Link to comment
Share on other sites

Re: Hospital/Jail Count stuck

good point a simple query would work better but instead of every minute it would be every refresh :) work it out...

a query every second or a query every minute... let me think...

and several queries in the count is also a issue i am just learning left join but im sure that could help

Link to comment
Share on other sites

Re: Hospital/Jail Count stuck

 

good point a simple query would work better but instead of every minute it would be every refresh :) work it out...

a query every second or a query every minute... let me think...

and several queries in the count is also a issue i am just learning left join but im sure that could help

Seems you are missing something... I've never told WHERE to place the query...

But then again reading your comments Zero, just makes me laugh, after seeing how you fix a minor issue on a script of your own :)

Let's see... House Insurance as you sell it... gives... 3 days insurance right? wrong! I pointed you that and was willing to tell you how, but then... how you fixed it? Added one more day so the 3 days would be covered... Nice fix from a guy that shows himself to everyone as being on a high coding standard.

Link to comment
Share on other sites

Re: Hospital/Jail Count stuck

 

I am not going to argue with you since you obviously know more than me.

so im sure you could clear up this full topic... since your such a perfect programmer...

if you have a issue with my coding im sure the ignore option on here would help you alot :-D

I know more than you? Who knows? Perfect programmer? Is there such a thing? And even far from being a programmer, i like to consider myself as a wannabe-zero-script-affect-kiddie so i can say (not) to everyone i know it all and how easy things are, until the day i get someone who's willing to help me and i act dumb! Issues with your coding? Why should I? You are the (pretensious) perfeccionist, not me. I just stated that for such a "perfeccionist programmer" you should accept others suggestions instead making literaly "dumb" fixes like that.

Link to comment
Share on other sites

Re: Hospital/Jail Count stuck

i did not want to argue but one quote from your previous post offends me dearly

a wannabe-zero-script-affect-kiddie

the script works fine and if you were a member of killah-city anymore you would know this.

if it works why fix it?

i didn't feel the need to comply with demands from a stuck up member who considered himself better than everyone.

you gave me suggestions but not the proper way theres a forum but im sure you didn't notice this since your stay was only approx 70+ days :-D

call me a script kiddie all you want mate but when it comes down to it i am learning i wanna learn and i am not afraid to ask for help when i learn.

so basically fuck you

Link to comment
Share on other sites

Re: Hospital/Jail Count stuck

LOL, at last you show your face :) down to insults, and even if i am writing on your mother language, seems you still don't know how to read. I called myself a script kiddie not you, but then, with that kind of reaction... i wonder... you are definetly a kid and it also seems i hit the nail on the head with that one :)

Link to comment
Share on other sites

Re: Hospital/Jail Count stuck

 

wannabe-zero-script-affect-kiddie

by adding my name in your referring to me being on maybe you should learn "my mother language" a little more...

ask anyone whos coded with me damn most of the people on ce ask me for help alot and i provide it to them depends on their approach to me.

i do dislike crons also im sure easier solutions like time stamp could be used but for a simple jail query cron would be more of a less pull on the database rather than in mainmenu or whatever...

code something lithium...

i ain't no script kiddie and ill prove it anyday and anytime you want (i know everything i proclaim)

read over your post referring to wannabe-zero-script-affect-kiddie and tell me how it sounds...

sorry for the cuss Nyna

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.

 Share

×
×
  • Create New...