PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
HaVoC
Forum Commoner
Posts: 83 Joined: Sat Feb 07, 2004 7:20 am
Location: Smiths Falls, CA
Post
by HaVoC » Mon Mar 01, 2004 9:11 pm
I'm trying to list players with points. So I'd do this
Code: Select all
<?php
if ($points > 0){
fdgdsfg
}
?>
Easy right? Well here's the tricky bit. When someone loses, they lose 1 point. How do I list people with points, and with negatory points, like -1 and -2?
redhair
Forum Contributor
Posts: 300 Joined: Fri May 30, 2003 4:36 pm
Location: 53.23N-6.57E
Contact:
Post
by redhair » Mon Mar 01, 2004 9:23 pm
HaVoC
Forum Commoner
Posts: 83 Joined: Sat Feb 07, 2004 7:20 am
Location: Smiths Falls, CA
Post
by HaVoC » Mon Mar 01, 2004 9:57 pm
Uh...what's that? lol
redhair
Forum Contributor
Posts: 300 Joined: Fri May 30, 2003 4:36 pm
Location: 53.23N-6.57E
Contact:
Post
by redhair » Tue Mar 02, 2004 6:18 am
$points = your variable
- = minus
= = is
2 = is a number
combined, they make the calculation,...
Like this code will add 2 points:
HaVoC
Forum Commoner
Posts: 83 Joined: Sat Feb 07, 2004 7:20 am
Location: Smiths Falls, CA
Post
by HaVoC » Tue Mar 02, 2004 4:49 pm
How does that list players with negatory points? I don't want to take their points away. I've already done that. Some players have a score of -1. How do I make the PHP display that?
markl999
DevNet Resident
Posts: 1972 Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)
Post
by markl999 » Tue Mar 02, 2004 4:51 pm
if ($points < 0){ ??
HaVoC
Forum Commoner
Posts: 83 Joined: Sat Feb 07, 2004 7:20 am
Location: Smiths Falls, CA
Post
by HaVoC » Tue Mar 02, 2004 8:41 pm
Don't worry about it. I'll find out a way. Your way will only show people who have less than 0 points. =/
tim
DevNet Resident
Posts: 1165 Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio
Post
by tim » Tue Mar 02, 2004 8:44 pm
correct me if i'm wrong, but:
isnt any number below dead "zero" considered negative?
Dr Evil
Forum Contributor
Posts: 184 Joined: Wed Jan 14, 2004 9:56 am
Location: Switzerland
Post
by Dr Evil » Wed Mar 03, 2004 3:45 am
If $points exists:
Code: Select all
<?php
if (isset($points)){
fdgdsfg
}
?>
Just make sure people who never played don't have 0 in their $points.
Or you could use:
Code: Select all
<?php
if (($points>0)or($points<0)){
fdgdsfg
}
?>
But people who had their points reduced to 0 won't appear.