jason360 Posted December 9, 2013 Share Posted December 9, 2013 Hey guys, I have an series of if statements that I believe to be correct, comparing to examples I have found. Anyway, the first 2 parts of the if statement work providing "Content #1" and "Content #2", however "Content #3" will not echo out. Instead of getting Content #3 it looks like I am getting a variation of Content #2. Any ideas what I am doing wrong here? Thank you! if($d['user_id'] == $_SESSION['user_id']):{ $result = mysql_query( "SELECT member_vote FROM member_rank WHERE member_id=".$d['user_id']."" ); list($vote) = mysql_fetch_array( $result ); return ' <div id="comment" > Content #1 </div> ';} elseif($d['user_id'] != $_SESSION['user_id']):{ $result = mysql_query( "SELECT member_vote FROM member_rank WHERE member_id=".$d['user_id']."" ); list($vote) = mysql_fetch_array( $result ); return ' <div id="comment" > Content #2 </div> ';} else: { $result = mysql_query( "SELECT member_vote FROM member_rank WHERE member_id=".$d['user_id']."" ); list($vote) = mysql_fetch_array( $result ); return ' <div id="comment" > Content #3 </div> ';} endif; Quote Link to comment Share on other sites More sharing options...
Solution mac_gyver Posted December 9, 2013 Solution Share Posted December 9, 2013 you are comparing $d['user_id'] with $_SESSION['user_id']. for equal/not-equal, there are only two choices. they either are equal to each other or they are not. Quote Link to comment Share on other sites More sharing options...
jason360 Posted December 10, 2013 Author Share Posted December 10, 2013 Thanks again mac_gyver! I added "empty($_SESSION['user_id']) &&" to my if statements, so that if the $_SESSION['user_id'] is empty it goes to my else statement. 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.