• 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!

[TFS 1.0] PHP Not loading country flags from database

trustjah

Newbie
Joined
Jan 22, 2009
Messages
124
Solutions
6
Reaction score
14
Location
Belgium
Anyone has an idea why my website isnt accesing the database,
well it is loading the players online, level and vocation but not the country flags.
xn7nzr.png

this is from my whoisonline.php
Code:
<img id="ContentBoxHeadline" class="Title" src="layouts/tibiacom/images/header/headline-whoisonline.gif" alt="Contentbox headline">
<?php
if(!defined('INITIALIZED'))
    exit;

$orderby = 'name';
if(isset($_REQUEST['order']))
{
    if($_REQUEST['order']== 'level')
        $orderby = 'level';
    elseif($_REQUEST['order'] == 'vocation')
        $orderby = 'vocation';
}
$players_online_data = $SQL->query('SELECT ' . $SQL->tableName('accounts') . '.' . $SQL->fieldName('flag') . ', ' . $SQL->tableName('players') . '.' . $SQL->fieldName('name') . ', ' . $SQL->tableName('players') . '.' . $SQL->fieldName('vocation') . ', ' . $SQL->tableName('players') . '.' . $SQL->fieldName('level') . ', ' . $SQL->tableName('players') . '.' . $SQL->fieldName('skull') . ', ' . $SQL->tableName('players') . '.' . $SQL->fieldName('looktype') . ', ' . $SQL->tableName('players') . '.' . $SQL->fieldName('lookaddons') . ', ' . $SQL->tableName('players') . '.' . $SQL->fieldName('lookhead') . ', ' . $SQL->tableName('players') . '.' . $SQL->fieldName('lookbody') . ', ' . $SQL->tableName('players') . '.' . $SQL->fieldName('looklegs') . ', ' . $SQL->tableName('players') . '.' . $SQL->fieldName('lookfeet') . ' FROM ' . $SQL->tableName('accounts') . ', ' . $SQL->tableName('players') . ', ' . $SQL->tableName('players_online') . ' WHERE ' . $SQL->tableName('players') . '.' . $SQL->fieldName('id') . ' = ' . $SQL->tableName('players_online') . '.' . $SQL->fieldName('player_id') . ' AND ' . $SQL->tableName('accounts') . '.' . $SQL->fieldName('id') . ' = ' . $SQL->tableName('players') . '.' . $SQL->fieldName('account_id') . ' ORDER BY ' . $SQL->fieldName($orderby))->fetchAll();
$number_of_players_online = 0;
$vocations_online_count = array(0,0,0,0,0); // change it if you got more then 5 vocations
$players_rows = '';
foreach($players_online_data as $player)
{
    $vocations_online_count[$player['vocation']] += 1;
    $bgcolor = (($number_of_players_online++ % 2 == 1) ?  $config['site']['darkborder'] : $config['site']['lightborder']);
    $skull = '';
    if ($player['skull'] == 4)
        $skull = "<img style='border: 0;' src='./images/skulls/redskull.gif'/>";
    else if ($player['skull'] == 5)
        $skull = "<img style='border: 0;' src='./images/skulls/blackskull.gif'/>";

    $players_rows .= '<TR BGCOLOR='.$bgcolor.'><TD WIDTH=5%><center><image src="images/flags/'.$acc['flag'].'.png"></center></TD><TD& BGCOLOR='.$bgcolor.'><TD WIDTH=65%><A HREF="?subtopic=characters&name='.urlencode($player['name']).'">'.htmlspecialchars($player['name']).$skull.'<TD WIDTH=10%>'.$player['level'].'</TD><TD WIDTH=20%>'.htmlspecialchars($vocation_name[$player['vocation']]).'</TD></TR>';
}   
if($number_of_players_online == 0)
{
    //server status - server empty
    $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD CLASS=white><B>Server Status</B></TD></TR><TR BGCOLOR='.$config['site']['darkborder'].'><TD><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=1><TR><TD>Currently no one is playing on <b>'.htmlspecialchars($config['server']['serverName']).'</b>.</TD></TR></TABLE></TD></TR></TABLE><BR>';
}
else
{
    //server status - someone is online
    $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD CLASS=white><B>Server Status</B></TD></TR><TR BGCOLOR='.$config['site']['darkborder'].'><TD><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=1><TR><TD>Currently '.$number_of_players_online.' players are online on <b>'.htmlspecialchars($config['server']['serverName']).'</b>.</TD></TR></TABLE></TD></TR></TABLE><br>';
    //list of players
    $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD CLASS=white><B>Country</B></A></TD><TD><A HREF="?subtopic=whoisonline&order=name" CLASS=white>Name</A></TD><TD><A HREF="?subtopic=whoisonline&order=level" CLASS=white>Level</A></TD><TD><A HREF="?subtopic=whoisonline&order=vocation" CLASS=white>Vocation</TD></TR>'.$players_rows.'</TABLE>';
    //search bar
    $main_content .= '<BR><FORM ACTION="?subtopic=characters" METHOD=post>  <TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4><TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" CLASS=white><B>Search Character</B></TD></TR><TR><TD BGCOLOR="'.$config['site']['darkborder'].'"><TABLE BORDER=0 CELLPADDING=1><TR><TD>Name:</TD><TD><INPUT NAME="name" VALUE="" SIZE="29" MAXLENGTH="29"></TD><TD><INPUT TYPE="image" NAME="Submit" SRC="'.$layout_name.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></TD></TR></TABLE></TD></TR></TABLE></FORM>';
}

Code:
<TR BGCOLOR='.$bgcolor.'><TD WIDTH=5%><center><image src="/images/flags/'.$acc['flag'].'.png"></center></TD>

image of how it looks in the database
nzn0xd.png


this is the link from the website
http://xxxxxxx.xxxxxx.com/images/flags/.png

it should acces the database and load the country's in (Spain, Germany, Brazil)
 
Last edited:
Solution
i've made some progress using

Code:
$flag = $SQL->query('SELECT flag FROM accounts')->fetch();
    $players_rows .= '<TR BGCOLOR='.$bgcolor.'><TD WIDTH=5%><center><img src="/images/flags/' . $flag['flag'] . '.jpg">
just not sure what to reffer to now.
The website is showing me another link to the picture now
http://xxxxxxxx/images/flags/unknown.jpg


Code:
    $flag = $SQL->query('SELECT flag FROM accounts')->fetch();
    $players_rows .= '<TR BGCOLOR='.$bgcolor.'><TD WIDTH=5%><center><img src="/images/flags/' . $player['flag'] . '.png">

^ ^ ^ ^ this is how i got it to work.
Nobody who can help me with this?
i've been fiddlin around with stuff but i'm not smart enough to figure this out.

Code:
$player_rows = $SQL->query('SELECT flag FROM accounts;');
    $players_rows .= '<TR BGCOLOR='.$bgcolor.'><TD WIDTH=5%><center><img src=\'/images/flags/'.$acc['flag'].'.png\'></center></TD><TD& BGCOLOR='.$bgcolor.'><TD WIDTH=65%><A HREF="?subtopic=characters&name='.urlencode($player['name']).'">'.htmlspecialchars($player['name']).$skull.'<TD WIDTH=10%>'.$player['level'].'</TD><TD WIDTH=20%>'.htmlspecialchars($vocation_name[$player['vocation']]).'</TD></TR>';

xn7nzr.png
 
Last edited:
i've made some progress using

Code:
$flag = $SQL->query('SELECT flag FROM accounts')->fetch();
    $players_rows .= '<TR BGCOLOR='.$bgcolor.'><TD WIDTH=5%><center><img src="/images/flags/' . $flag['flag'] . '.jpg">
just not sure what to reffer to now.
The website is showing me another link to the picture now
http://xxxxxxxx/images/flags/unknown.jpg


Code:
    $flag = $SQL->query('SELECT flag FROM accounts')->fetch();
    $players_rows .= '<TR BGCOLOR='.$bgcolor.'><TD WIDTH=5%><center><img src="/images/flags/' . $player['flag'] . '.png">

^ ^ ^ ^ this is how i got it to work.
 
Last edited:
Solution
Back
Top