Jump to content
xisto Community
Sign in to follow this  
Amezis

Unexpected $ Where There Aren't Any

Recommended Posts

I am getting this message when testing a script I made:

Parse error: parse error, unexpected $ in /home/globa38/public_html/forum/mods/phpbb_fetch_all/news/forumnews.php on line 159

On line 159, which is the last line in that file, I can only see this:
?>

What's the problem, and how can I fix it? :D

Share this post


Link to post
Share on other sites
<?for ($i = 0; $i < count($news); $i++) {{$max_length = 27;$title = ($news[$i]['topic_title']);$title_length = strlen($title);if ($title_length > $max_length){$title = substr_replace($title, '...', $max_length);}?>    	<tr>       <td class="newshover">       <?php echo append_sid('http://forum.global-rs.com/viewtopic.php?t=' . $news[$i]['topic_id']); ?>">       <?php echo date('d-M-Y',$news[$i]['post_time']); ?> - <?php echo($title); ?></a></td>    	<tr><?php}?>

Share this post


Link to post
Share on other sites

hmm idunno
maybe you can try this:

change

<?php echo date('d-M-Y',$news[$i]['post_time']); ?> - <?php echo($title); ?></a></td>

to:

<?php echo date('d-M-Y',$news[$i]['post_time']); ?> - <?php echo $title; ?></a></td>

Share this post


Link to post
Share on other sites

As far as I can see you have some extra braces. You have one extra { at the beginning that is never closed. Also, try not to break out of PHP into HTML in the middle of a for loop, as it can sometimes cause problems. Just put each line as an echo.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.