Jump to content

Display records if a condition is met otherwise display 'You must upgrade'


cormac

Recommended Posts

Hi,

 

New to the site!  ;D And I'm hoping someone can tell me the PHP code (or point me towards a tutorial that will help me) to do:

 

in semi-technical terms:

 

Check someone's membership status in one MySQL database field and if it is correct,then  to display the records from a different database field, if their membership status is incorrect to display 'You must upgrade your account to see this information'

 

in more simple terms

 

Check an employers status - if they are a Gold Member it should display an employees telephone number - otherwise it should display 'You must upgrade your account to see this information' 

 

Thanks :)

Link to comment
Share on other sites

//some code gets the account type
$get = mysql_query("SELECT `telephone` FROM `tbl_name` WHERE `fieldname`='SOMETHING' ") or die (mysql_error());
if (mysql_num_rows($get) == 1)
{
  if ($membertype = "gold")
   { 
     list($tel) = mysql_fetch_array($get);
     echo $tel;
    }
  else
    {
      echo "You must upgrade your account to see this information";
     }
}
else
{
echo "Telephone number not found";
}

Something like that.

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.