Jump to content

Check mysql database for user


monkeybidz

Recommended Posts

Im trying to check if a user exist in database table only if another check =YES:

 

$sql="SELECT * FROM my_members WHERE my_private=$my_private AND my_id=$my_id";

 

$my_private should = 'Yes' or 'No'.

 

If 'Yes', i need to run another check....

 

$sql="SELECT * FROM my_favorites WHERE my_id=$my_id AND my_uid=$sessionuser";

 

This check should check to see if $sessionuser exists in my_favorites..

 

How can i make the first one call the second only if $my_private=Yes? Or is this code even correct?

Link to comment
https://forums.phpfreaks.com/topic/69846-check-mysql-database-for-user/
Share on other sites

Both did not work for me in that page, but did work in others. What i cant get it to recognize both variables at the same time.

 

If($my_private=='Yes' && !$sessionuser) {

      header("Location: gen_confirm.php?errmsg=".urlencode("This user has profile set to private. Only friends can view this page.<BR><a href=".addme_request.php.">Click here to request to be added.</a>"));

die();

}

 

I can get it to check the my_private, but not the my_ud from database.  ???

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.