SauloA Posted January 27, 2007 Share Posted January 27, 2007 I have a cell in my table where I want to make a link that sends the user to another page on my site. I want the text in my cell to appear as a link depending on a users access level. If the user has an access level of 2 there shouldn't be a link otherwise the link does display.Here's some code I've been working on that doesn't work, but is kind of the concept that I want. I'd appreciate the help.<?php if (!(strcmp($_SESSION['MM_UserLevel'],2))) {echo $row_rsReviews['urev_id'];} else {<a href="editreviews.php?revID=<?php echo $row_rsReviews['urev_id']; ?>"><?php echo $row_rsReviews['urev_date']; ?></a>}?>The problem is most likely everything after the else statement, but since I'm kinda new to PHP I wouldn't know. Link to comment https://forums.phpfreaks.com/topic/35909-solved-restricting-access-to-a-link-help/ Share on other sites More sharing options...
Jessica Posted January 27, 2007 Share Posted January 27, 2007 You never closed your PHP before starting the HTMLchange to [code]} else {?><a href="editreviews.php?revID=<?php echo $row_rsReviews['urev_id']; ?>"><?php echo $row_rsReviews['urev_date']; ?>[/url]<?php}[/code]Not sure what the url code is for. Link to comment https://forums.phpfreaks.com/topic/35909-solved-restricting-access-to-a-link-help/#findComment-170272 Share on other sites More sharing options...
SauloA Posted January 27, 2007 Author Share Posted January 27, 2007 I took off the "[/url]" from you code and also you forgot to end if with "?>" so I added it. Other then what I listed, the code worked exactly how I wanted. Thanks a bunch. Link to comment https://forums.phpfreaks.com/topic/35909-solved-restricting-access-to-a-link-help/#findComment-170295 Share on other sites More sharing options...
Jessica Posted January 27, 2007 Share Posted January 27, 2007 The "[/url]" was in YOUR code.You're welcome. Link to comment https://forums.phpfreaks.com/topic/35909-solved-restricting-access-to-a-link-help/#findComment-170298 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.