Jump to content


Photo

if else statement returns same value?


  • Please log in to reply
2 replies to this topic

#1 mourningreign

mourningreign
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 17 October 2006 - 05:42 PM

The goal of this is to not return 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;

?>

#2 jvrothjr

jvrothjr
  • Members
  • PipPipPip
  • Advanced Member
  • 300 posts
  • LocationOhio

Posted 17 October 2006 - 05:47 PM

<?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 2
if  ($row_rsDJeventsignup['member'] == $a) {
	echo $c;
} else {
	if ($row_rsDJeventsignup['member'] == $b) {echo $d;}
}
?> 
 

If you understand everything you know nothing!

http://rcchjr.awardspace.com/

#3 mourningreign

mourningreign
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 17 October 2006 - 06:01 PM

:D

This 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;
}
?>




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users