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

Help with simple PHP problem

gnr

New Member
Joined
Dec 18, 2008
Messages
92
Reaction score
0
Hello everyone ^_^

Well, I'm trying to edit the script WhoIsOnline Flags show, where if there's no flag in player's account, it shows an error image.

Error:

Warning: Error parsing D:/Elf Server/config.lua on line 140 in D:\xampp\htdocs\config-and-functions.php on line 13

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in D:\xampp\htdocs\highscores.php on line 78

This part that I'm editing:

PHP:
$acc = $SQL->query('SELECT * FROM '.$SQL->tableName('accounts').' WHERE '.$SQL->fieldName('id').' = '.$skill['account_id'].'')->fetch();
if(!$acc['flag']) {
$flagimg = "http://img10.imageshack.us/img10/1705/icoerror.gif";
} else{
$flagimg = "flags/'.$acc['flag'].'.png";
}

Line 78:
PHP:
$flagimg = "flags/'.$acc['flag'].'.png";

This is the table:

PHP:
$main_content .= '<tr bgcolor="'.$bgcolor.'"><td><center><image src="$flagimg"></center></td><td>'.($offset + $number_of_rows).'.</td><td><a href="?subtopic=characters&name='.urlencode($skill['name']).'">'.($skill['online']>0 ? "<font color=\"green\">".$skill['name']."</font>" : "<font color=\"red\">".$skill['name']."</font>").'</a><br><small>'.$skill['level'].' '.$vocation_name[$world_id][$skill['promotion']][$skill['vocation']].'</small></td><td><center>'.$skill['value'].'</center></td>';

Help, please!
 
Try this :D

PHP:
$acc = $SQL->query('SELECT * FROM '.$SQL->tableName('accounts').' WHERE '.$SQL->fieldName('id').' = '.$skill['account_id'].'')->fetch();
if(empty($acc['flag'])) {
$flagimg = 'http://img10.imageshack.us/img10/1705/icoerror.gif';
} else{
$flagimg = 'flags/'.$acc['flag'].'.png';
}
 
Well, i tried that, now the error is:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1' in D:\xampp\htdocs\highscores.php:75 Stack trace: #0 D:\xampp\htdocs\highscores.php(75): PDO->query('SELECT * FROM `...') #1 D:\xampp\htdocs\index.php(106): include('D:\xampp\htdocs...') #2 {main} thrown in D:\xampp\htdocs\highscores.php on line 75

Line 75:

PHP:
$acc = $SQL->query('SELECT * FROM '.$SQL->tableName('accounts').' WHERE '.$SQL->fieldName('id').' = '.$skill['account_id'].'')->fetch();
 
Back
Top