Jump to content

if else statement returns same value?


mourningreign

Recommended Posts

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
Share on other sites

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

[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.