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! Link to comment https://forums.phpfreaks.com/topic/104895-solved-code-error-i-dont-understand/ 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... Link to comment https://forums.phpfreaks.com/topic/104895-solved-code-error-i-dont-understand/#findComment-536822 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. Link to comment https://forums.phpfreaks.com/topic/104895-solved-code-error-i-dont-understand/#findComment-536834 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.