Lizardking, little help
Lizardking, little help
CatFlea X |
Jan 20 2004, 02:52 PM
Post
#16
|
Padawan Group: Members Posts: 35 Joined: 6-January 04 From: UK Member No.: 89 |
Thanx Beast
I will just have to wait for the server now, then I will see if its ok, I will tell ya if I go wrong, but by the looks of things, not even I can go wrong now -------------------- |
TheBeast |
Jan 20 2004, 02:56 PM
Post
#17
|
Master Group: -=RJ=-Clan Posts: 444 Joined: 18-June 03 From: Quebec...woohoo !!! Member No.: 12 |
oh by the way Cat Flea... for the script to work properly... don't forget to change the IP address and Port in the 'serverstats.php' file with your own... if you don,t do it... then you'll always be displaying information about the RJ clan server
- Beast -------------------- "Separately, woman and alcohol can be quite fun... but when you mix them, they can make you a dumbass"
- Red, That's 70's Show :) |
CatFlea X |
Jan 21 2004, 01:55 AM
Post
#18
|
Padawan Group: Members Posts: 35 Joined: 6-January 04 From: UK Member No.: 89 |
he he, aint entirely stupid you know
well, I have the server stats up and runnin, but its givin me an error message for something on line 10 on the php file i used to display it (I swear I only copied and pasted your info from the displayserverstats and just put it in my own kinda table on my own .php file Oh well, I will go look at it now, I will tell ya if I cant fix it lol. --EDIT-- The strange thing is, when I was displaying RJ Servers Stats, it was fine -------------------- |
CatFlea X |
Jan 21 2004, 02:01 AM
Post
#19
|
Padawan Group: Members Posts: 35 Joined: 6-January 04 From: UK Member No.: 89 |
I cant seem to fix it, this is the error message which gets shown
QUOTE Warning: Variable passed to each() is not an array or object in /home/myth/public_html/rside.php on line 10 and this is line 1 - 15 CODE <center> <!-- Start Server Stats --> <?php include "serverstats.php"; // Will count the number of player currently connected (not including bots) $nb_players=0; while (list($key, $data) = each ($players)) { if($data["ping"] != 0) { $nb_players = $nb_players + 1; } } ?> So line 10 is CODE while (list($key, $data) = each ($players)) { So where's the error? -------------------- |
TheBeast |
Jan 21 2004, 09:41 AM
Post
#20
|
Master Group: -=RJ=-Clan Posts: 444 Joined: 18-June 03 From: Quebec...woohoo !!! Member No.: 12 |
Did you changed the name of the first php file (the one I had named serverstats.php) ???
or did you place it in the same folder as the other one ??? I think the error is because, the script can find the other file... so he can create the 2 variables $variables and $players (which are both arrays). - Beast -------------------- "Separately, woman and alcohol can be quite fun... but when you mix them, they can make you a dumbass"
- Red, That's 70's Show :) |
CatFlea X |
Jan 21 2004, 11:42 AM
Post
#21
|
Padawan Group: Members Posts: 35 Joined: 6-January 04 From: UK Member No.: 89 |
nope, I havn't re-named anything
and yea, i have it in the same folder as the other one -------------------- |
TheLizardKing |
Jan 21 2004, 12:35 PM
Post
#22
|
Secretive Rodian Lover Hater Group: Admin Posts: 93 Joined: 13-June 03 From: Orlando, Florida, United States of America Member No.: 1 |
QUOTE(CatFlea X @ Jan 21 2004, 02:01 AM) I cant seem to fix it, this is the error message which gets shown QUOTE Warning: Variable passed to each() is not an array or object in /home/myth/public_html/rside.php on line 10 and this is line 1 - 15 CODE <center> <!-- Start Server Stats --> <?php include "serverstats.php"; // Will count the number of player currently connected (not including bots) $nb_players=0; while (list($key, $data) = each ($players)) { if($data["ping"] != 0) { $nb_players = $nb_players + 1; } } ?> So line 10 is CODE while (list($key, $data) = each ($players)) { So where's the error? OK this is just me nit-picking but you could but you could have CODE $nb_players = $nb_players + 1; // could be: $nb_players++; Just me being awesome -------------------- AS;LDJFA;LSKFADS
|
TheLizardKing |
Jan 21 2004, 12:38 PM
Post
#23
|
Secretive Rodian Lover Hater Group: Admin Posts: 93 Joined: 13-June 03 From: Orlando, Florida, United States of America Member No.: 1 |
OH and I also think your getting that error cause your players array may have no data in it due to you know... not having any players playing. You can just simply use an if to test if players are playing or something along those lines.
-------------------- AS;LDJFA;LSKFADS
|
CatFlea X |
Jan 21 2004, 12:47 PM
Post
#24
|
Padawan Group: Members Posts: 35 Joined: 6-January 04 From: UK Member No.: 89 |
so you want me to change
CODE $nb_players = $nb_players + 1; to CODE $nb_players++; What would that do??? -------------------- |
CatFlea X |
Jan 21 2004, 12:49 PM
Post
#25
|
Padawan Group: Members Posts: 35 Joined: 6-January 04 From: UK Member No.: 89 |
QUOTE(TheLizardKing @ Jan 21 2004, 12:38 PM) OH and I also think your getting that error cause your players array may have no data in it due to you know... not having any players playing. You can just simply use an if to test if players are playing or something along those lines. use an if? Have you still not caught on that I am PHP Illiterate? an if? That could be anything to me Damn it, I need to learn PHP and the programin stuff that you guys are all giving me help with -------------------- |
CatFlea X |
Jan 21 2004, 12:58 PM
Post
#26
|
Padawan Group: Members Posts: 35 Joined: 6-January 04 From: UK Member No.: 89 |
hey Liz (are you Liz, or is there sum1 else called Liz who I havn't met? - Can I call you Liz? - But anyways)
Yes, it is coz I dont have anybody on the server that it shows the error message, coz I just connected thru windowed view and the message went away The last code you gave me, would that fix it? or not? -------------------- |
TheBeast |
Jan 21 2004, 01:24 PM
Post
#27
|
Master Group: -=RJ=-Clan Posts: 444 Joined: 18-June 03 From: Quebec...woohoo !!! Member No.: 12 |
No... it won't fix that problem... it will only make the code more 'sexy' to those PHP litterate... like Liz
But what you need is something to be added to code... that will test if there is some players on the server before counting them. it would look something like this... but I don't know if the function I'm using is the right one... Liz ??? So this ... CODE while (list($key, $data) = each ($players)) { if($data["ping"] != 0) { $nb_players = $nb_players + 1;}} should become this... CODE if (isset($players)){ while (list($key, $data) = each ($players)) { if($data["ping"] != 0) { $nb_players = $nb_players + 1;}} } - Beast -------------------- "Separately, woman and alcohol can be quite fun... but when you mix them, they can make you a dumbass"
- Red, That's 70's Show :) |
CatFlea X |
Jan 21 2004, 01:34 PM
Post
#28
|
Padawan Group: Members Posts: 35 Joined: 6-January 04 From: UK Member No.: 89 |
well, I will try it now
*tests the code to see if it works* ... ... ... Nope, it now gives me a parse error -------------------- |
CatFlea X |
Jan 21 2004, 01:36 PM
Post
#29
|
Padawan Group: Members Posts: 35 Joined: 6-January 04 From: UK Member No.: 89 |
Wait no
Beast, you were right I just forgot to delete some of the close brackets '}' its workin fine now THANK YOU BEAST! THANK YOU LIZ! -------------------- |
TheBeast |
Jan 21 2004, 02:41 PM
Post
#30
|
Master Group: -=RJ=-Clan Posts: 444 Joined: 18-June 03 From: Quebec...woohoo !!! Member No.: 12 |
No prob... so now... post a link so we can see what you've done
- Beast -------------------- "Separately, woman and alcohol can be quite fun... but when you mix them, they can make you a dumbass"
- Red, That's 70's Show :) |
Lo-Fi Version | Time is now: 20th April 2024 - 07:59 AM |