kyleldi Posted May 9, 2008 Share Posted May 9, 2008 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! Quote Link to comment Share on other sites More sharing options...
rarebit Posted May 9, 2008 Share Posted May 9, 2008 <?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... Quote Link to comment Share on other sites More sharing options...
Fadion Posted May 9, 2008 Share Posted May 9, 2008 Is that php? It is missing everything, curly braces, equlity operator, quotes, semicolons. Start from the very basics before attempting to write scripts. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.