Jump to content

[SOLVED] Code error I don't understand


kyleldi

Recommended Posts

Hi All,

 

I'm doing a simple if/then statement that will display a certain image if a users permissions are a certain number (1), while displaying a different image for all others.  Here's my code:

 

<?php if ($row_rs_nav['permissionlevel']) = 1
echo <div class="headingsplash" id="headingmanage"><a href="http://www.domain.com"><img src="images/manageusers.jpg" alt="Manage Users" width="60" height="45" /></div>
else echo <div class="headingsplash" id="headingmanage"><img src="images/blue.jpg" alt="Manage Users" width="60" height="45" /></div> ?>

 

For some reason, when I execute the page, i get the error "Parse error: syntax error, unexpected '=' in /services/main.php on line 144"  This line is of course, the if statement.

 

Can anyone see what i'm doing wrong?  Thanks!

Link to comment
https://forums.phpfreaks.com/topic/104895-solved-code-error-i-dont-understand/
Share on other sites

<?php 
if ($row_rs_nav['permissionlevel']==1)
{
echo '<div class="headingsplash" id="headingmanage"><a href="http://www.domain.com"><img src="images/manageusers.jpg" alt="Manage Users" width="60" height="45" /></div>';
}
else
{
echo '<div class="headingsplash" id="headingmanage"><img src="images/blue.jpg" alt="Manage Users" width="60" height="45" /></div> ?>';
}

Your if statement was wrong, also added quotes for the echoes...

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.