jswinkelman Posted March 17, 2007 Share Posted March 17, 2007 I need to modify this code so that it only shows a link if the Member_Status<>Inactive (ie, Active and Lifetime Members get a link). It gets a little tricky because I already have an "if statement" to show the Member_Middle (middle name), if it exists. Right now it shows a link for all members. <a href="/member_detail.php?recordID=<?php echo $row_rs_Name['Member_ID']; ?>"> <?php echo $row_rs_Name['Member_First']; ?> <?php if(!is_null($row_rs_Name['Member_Middle'])) echo $row_rs_Name['Member_Middle'].' '; ?><?php echo $row_rs_Name['Member_Last']; ?> <?php if (!is_null($row_rs_Name['Member_Suffix'])) echo ', '. $row_rs_Name['Member_Suffix']; ?></a> Any suggestions? Thanks! Link to comment https://forums.phpfreaks.com/topic/43173-nested-if-statements/ Share on other sites More sharing options...
per1os Posted March 18, 2007 Share Posted March 18, 2007 <?php if (!is_null($row_rs_Name['Member_Status']) && strtolower($row_rs_Name['Member_Status']) != "inactive") $memberLink = '<a href="member.php?link=link">Member Link</a>'; ?> <a href="/member_detail.php?recordID=<?php echo $row_rs_Name['Member_ID']; ?>"> <?php echo $row_rs_Name['Member_First']; ?> <?php if(!is_null($row_rs_Name['Member_Middle'])) echo $row_rs_Name['Member_Middle'].' '; ?><?php echo $row_rs_Name['Member_Last']; ?> <?php if (!is_null($row_rs_Name['Member_Suffix'])) echo ', '. $row_rs_Name['Member_Suffix']; ?></a> <?php print $memberLink; ?> There is one way to do it. Link to comment https://forums.phpfreaks.com/topic/43173-nested-if-statements/#findComment-209660 Share on other sites More sharing options...
jswinkelman Posted March 18, 2007 Author Share Posted March 18, 2007 This doesn't really do it. It makes a secondary link after the member name (First Middle Last) link and every entry has a link, including inactive members. Is there a way to define Member_Full as the full name so I wouldn't have all those "if statements" from the name when trying to code the "if statement" for the link? Link to comment https://forums.phpfreaks.com/topic/43173-nested-if-statements/#findComment-209745 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.