Jump to content

Parse error: syntax error, unexpected '}'


wolf530

Recommended Posts

Sometimes php just confounds me. I'm obviously an amateur, so please bear with me here, but I can't figure out what the heck I'm missing -- all of the brackets seem accounted for!

 

I'm trying to use the IPB SDK. According to the error message, the problem is on line 8 in the example code below:

 

<?php $member = $SDK->get_info();
if($SDK->is_loggedin()); { ?>
	$pms = $SDK->get_num_new_pms();
	if( $pms > 0 ); { ?>
			<a href="http://www.myserver.com/forums/index.php?act=Msg"><img id="new-messages" src="http://www.myserver.com/new-msgs.gif" alt="" border="0"></a>
		<?php } if( $pms == 0 ); { ?>
			<a href="http://www.myserver.com/forums/index.php?act=Msg"><img id="new-messages" src="http://www.myserver.com/no-msgs.gif" alt="" border="0"></a>
		<?php } } else { ?>
			<a href="http://www.myserver.com/forums/index.php?act=Login&CODE=00"><img id="new-messages" src="http://www.myserver.com/login.gif" alt="" border="0"></a>
		<?php } ?>

 

Many thanks!

Link to comment
https://forums.phpfreaks.com/topic/97451-parse-error-syntax-error-unexpected/
Share on other sites

 

 

 

 

<?php $member = $SDK->get_info();
if($SDK->is_loggedin()); {
	$pms = $SDK->get_num_new_pms();
	if( $pms > 0 ); { ?>
			<a href="http://www.myserver.com/forums/index.php?act=Msg"><img id="new-messages" src="http://www.myserver.com/new-msgs.gif" alt="" border="0"></a>
		<?php } if( $pms == 0 ); { ?>
			<a href="http://www.myserver.com/forums/index.php?act=Msg"><img id="new-messages" src="http://www.myserver.com/no-msgs.gif" alt="" border="0"></a>
		<?php } }else{ ?>
			<a href="http://www.myserver.com/forums/index.php?act=Login&CODE=00"><img id="new-messages" src="http://www.myserver.com/login.gif" alt="" border="0"></a>
		<?php } ?>

 

Many thanks!

 

try that

Remove the ";" after the "if" conditions.

 

You can also stay in PHP for the whole piece of code:

<?php
$member = $SDK->get_info();
if($SDK->is_loggedin()) {
	$pms = $SDK->get_num_new_pms();
	if( $pms > 0 )
		echo '<a href="http://www.myserver.com/forums/index.php?act=Msg"><img id="new-messages" src="http://www.myserver.com/new-msgs.gif" alt="" border="0"></a>';
	if( $pms == 0 )
		echo '<a href="http://www.myserver.com/forums/index.php?act=Msg"><img id="new-messages" src="http://www.myserver.com/no-msgs.gif" alt="" border="0"></a>';
	else
		echo '<a href="http://www.myserver.com/forums/index.php?act=Login&CODE=00"><img id="new-messages" src="http://www.myserver.com/login.gif" alt="" border="0"></a>';
?>

 

Ken

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

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.