[PHP] How 2 Fix this...

⚠️
Self Deleted
10 Happy Years
Joined
Aug 10, 2009
Messages
210
Reaction score
17
Hey RaGEZONE,

I have my own GunZ Private server and ofcourse a website for it.

Visit: Beyond GunZ - Ranking & Beyond GunZ - Clan Ranking

There you can see that there are empty places at the ranking.
My friend told me a little script but that doesn't work.
It was something like this:

PHP:
if (Name == null)
dontshow
else
{
show

So what is the good PHP code for it o.o ?
That he don't show the empty places?

Thanks & Regards,

Rick.
 
Assuming its fetching from a mysql database;
PHP:
if (empty($row['Name'])) { 
echo "Name unavailable";
}else{
echo($row['Name']);
}
 
The code that he posted is interchangeable. You are also not telling anyone what error it is giving you. In my opinion both the replies were correct with the information you have given.also:
PHP:
if(strlen(Name) != 0)){
show
}
 
Last edited:
Hmm both codes didn't worked.

Look this is my clan ranking page (PHP):

PHP:
Removed for copy naabs :D


And I just pasted it under the <title> </title> but that didn't worked.
So where I have to paste it
 
Last edited:
What you need is to alter your SQL query, so that those "nonamers" aren't part of the query.

Change line 8:
PHP:
$vraag = odbc_exec($connect, "SELECT TOP $limit* FROM Clan ORDER BY Point DESC");
to:
PHP:
$vraag = odbc_exec($connect, "SELECT TOP $limit* FROM Clan WHERE [Name] IS NOT NULL ORDER BY Point DESC");

The magic happens here:
WHERE [Name] IS NOT NULL

This should sort out any player with no name.
The tricky part is that I dont know the name of the column that stores those playernames.
Please look it up and correct [Name] if needed.

Cheers
 
Last edited:
Okay thanks I will try this.

---------- Post added at 11:00 AM ---------- Previous post was at 10:47 AM ----------

Hmm Clanranking is fixed now but character ranking not :S

I did this at Char Ranking:

PHP:
$vraag = odbc_exec($connect, "SELECT TOP $limit* FROM Character WHERE [Name] IS NOT NULL ORDER BY Level DESC");

Table Name = Character
Character Name = Name
Level = Level

What is the good code for Character o.o ?

Beyond GunZ - Ranking <-- Not Fixed
Beyond GunZ - Clan Ranking <-- Fixed, Thnx
 
Back