mourningreign Posted October 17, 2006 Share Posted October 17, 2006 The goal of this is to [b]not return[/b] the link if the user is a member. This page follows a query of the database after a form submission for an event signup. I've tried it with single = and the result is the same. Inquiries to my local php user group just have me more confused. The rs is returning the correct value and no errors are coming up.<?php$a = 'Not a Member';$b = 'a Member';$c = '<a href="vip/comp.php">Click here for a complimentary VIP level membership.</a>';$d = ' '; if ($row_rsDJeventsignup['member'] == $a) echo $c; elseif ($row_rsDJeventsignup['member'] == $b); echo $d;?> Link to comment https://forums.phpfreaks.com/topic/24237-if-else-statement-returns-same-value/ Share on other sites More sharing options...
jvrothjr Posted October 17, 2006 Share Posted October 17, 2006 [code=php:0]<?php$a = 'Not a Member';$b = 'a Member';$c = '<a href="vip/comp.php">Click here for a complimentary VIP level membership.[/url]';$d = ' ';// Option 1 if ($row_rsDJeventsignup['member'] == $a) {$msg = $c;}if ($row_rsDJeventsignup['member'] == $b) {$msg = $d;}echo $msg;//Option 2if ($row_rsDJeventsignup['member'] == $a) { echo $c;} else { if ($row_rsDJeventsignup['member'] == $b) {echo $d;}}?> [/code] Link to comment https://forums.phpfreaks.com/topic/24237-if-else-statement-returns-same-value/#findComment-110167 Share on other sites More sharing options...
mourningreign Posted October 17, 2006 Author Share Posted October 17, 2006 :DThis works:<?php $a = 'Not a Member';$b = 'a Member';$c = '<a href="vip/comp.php">Click here for a complimentary VIP level membership.</a>';$d = ' ';if (strcmp($row_rsDJeventsignup['member'],$a)==0) { echo $c;}?> Link to comment https://forums.phpfreaks.com/topic/24237-if-else-statement-returns-same-value/#findComment-110173 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.