Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.