• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[SQL] Characters information

juninroxy

New Member
Joined
Oct 5, 2007
Messages
11
Reaction score
0
[PHP/SQL]

I've been making some modifications so characters.php would give a nicier design to the information of each character. But now I need help on something and hope someone here could help me.

I just need a code to be added so when the player does not have a guild it shows: "The player doesn't have a guild" instead of just blank space where it should be.

The code that writes the name of the guild is:

----
if ($player->isAttr('guild_name')){
echo '<b>*Guild:</b> '.$player->getAttr('guild_rank').' of <a href="guilds.php?guild_id='.$player->getAttr('guild_id').'">'.htmlspecialchars($player->getAttr('guild_name')).'</a>'."\n";
}
----

I don't know how to put an ELSE that works with it, to give the result I want.

Can someone help me?
thanks =)
 
Last edited:
PHP:
if ($player->isAttr('guild_name')){
    echo '<b>*Guild:</b> '.$player->getAttr('guild_rank').' of <a href="guilds.php?guild_id='.$player->getAttr('guild_id').'">'.htmlspecialchars($play er->getAttr('guild_name')).'</a>'."\n";
} else {
    echo '<b>*Guild:</b> The player doesn\'t have a guild.';
}
 
Hi absolute!
Thank you for the fast reply.



I pasted it there, but its giving me a blank screen.. what can be wrong?



thx again
 
Hi absolute!
Thank you for the fast reply.



I pasted it there, but its giving me a blank screen.. what can be wrong?



thx again

maybe $player->isAttr('guild_name') is still returning something and not NULL/false?
 
Try this one.
PHP:
if ($player->getAttr('guild_name')){
    echo '<b>*Guild:</b> '.$player->getAttr('guild_rank').' of <a href="guilds.php?guild_id='.$player->getAttr('guild_id').'">'.htmlspecialchars($player->getAttr('guild_name')).'</a>'."\n";
} else {
    echo '<b>*Guild:</b> The player doesn\'t have a guild.';
}
 
If you can wait 2-3 hours I would be more than delighted to help you. But currently, I'm at work so can't really do anything.
 
Give me a private message with your MSN and I'll assist you through there.
 
Back
Top