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 :)

//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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.