Parse error: syntax error, unexpected $end

Thanks for taking the time to read this, I’m a beginner with php, so please be gentle :stuck_out_tongue:

I am currently getting this: Parse error: syntax error, unexpected $end in /home/anon/public_html/templates/bumble_bee/mods/top_players.php on line 29

[php]<?php ‘

    ’;

    $sql = mysql_query(“SELECT * FROM ava_users ORDER BY 0+points desc LIMIT $template[homepage_topplayers_limit]”);
    while($row = mysql_fetch_array($sql)) {

'<div align="center">'.$name = shortenStr($row['username'], 13);

$username = htmlspecialchars($name);
		
$url = ProfileUrl($row['id'], $row['seo_url']);

if ($setting['module_thumbs'] == 1) {
	$avatar = '<img alt="'.$name.'" src="'.AvatarUrl($row['avatar'], $row['facebook'], $row['facebook_id']).'" width="64" height="64" />';
}
else {
	$avatar = '';
}

echo $avatar.' <div class="top_players_info">&nbsp;<a href="'.$url.'">'.$username.'</a>';
if ($row['points'] != '') {
	echo $row['points'].' '.PTS.'"</div>" "</div>";
}

}

“<’/ul>”

php?>[/php]

<?php '
    '; along with "<'/ul>" do nothing at all, they need to be echoed. '
    '.$name = shortenStr($row['username'], 13); needs to have a variable in front for it to be valid. and remove the html from infront of $name. echo $row['points'].' '.PTS.'"
    " ""; is invalid. should be echo $row['points']." ".PTS.""; "<'/ul>" needs to be "
"; closing tag is wrong, just needs to be ?>

With forums. you can generally tell by the color if something is wrong and where the wrong thing is.

After applying what you said, and making some progress on what I plan to do.

I get the below error

Thanks for having a look.

[php]<?php
echo ‘

    ’;
    $sql = mysql_query(“SELECT * FROM ava_users ORDER BY 0+points desc LIMIT $template[homepage_topplayers_limit]”);
    while($row = mysql_fetch_array($sql)) {
$name = shortenStr($row['username'], 13);

$username = htmlspecialchars($name);
		
$url = ProfileUrl($row['id'], $row['seo_url']);

if ($setting['module_thumbs'] == 1) {
	$avatar = '<img alt="'.$name.'" src="'.AvatarUrl($row['avatar'], $row['facebook'], $row['facebook_id']).'" width="60" height="60" style="vertical-align: middle; border:2px solid #000;
                          -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px;" />';
}
else {
	$avatar = '';
}
echo '<li>'.$avatar.' <div class="top_players_info">&nbsp;<a href="'.$url.'">'.$username.'</a><br /></li>';
echo 'With ';
if ($row['points'] != '') {
	
	echo $row['points'].'<td colspan="2" style="color:#000;text-align:center;">'.'.PTS.''</div></td>';
}
else {
	echo '<img src="'.$setting['site_url'].'/templates/bumble_bee/images/games.png" style="padding:0; border:0; background: transparent; float: left;" align="left" alt="points" />(0 '.PTS.')</div>';
}
echo '<div class="clear"></div></div>';

}
echo ‘’;
?>[/php]

forgot to include the error it is

syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ‘,’ or ‘;’ on line 23

Which one is line 23? You’re missing a ; somewhere.

line 23 is

[php]echo $row[‘points’] “

’’.PTS.’’”;[/php]

Don’t know why you took the period out, or why row[points] is outside the cell, but this is what it should be
[php]
echo “

$row[points]”.PTS."";
[/php]

You were missing a period, and you can’t use like quotes in the same string, they terminate each other. if you do colspan=“2”, it thinks that the first " is ending the “<td colspan=” and the one after is starting a new string.

there’s 2 ways around this. 1 way is the escape the inner quotes (“string”) and the 2nd way is to use opposite quotes ("

"), doesn’t matter which quotes you use on the outside, anything on the inside has either be escaped or the opposite.
hello , please replace below line echo $row['points'].''.'.PTS.''';

with below line
echo $row[‘points’].‘

PTS’;

i hope this will helpful for you.
SR

It may fix the error but the hltml will be wrong. Though i was assuming PTS was from a define(), but yea i guess could be points lol :slight_smile:

Sponsor our Newsletter | Privacy Policy | Terms of Service