Jump to content

[SOLVED] Check for photo contributors


StanLytle

Recommended Posts

I'm trying to search a table to find if a person has contributed a photograph(s) that has been approved, and if so, establish a variable with a value of 0 or 1.  I've tried all kinds of things, but I just don't do this stuff enough to get the hang of it.  Here's the latest failed version.

 

$sql_query = "SELECT DISTINCT MemberID FROM Photographs WHERE Approved = '1'";

$result = mysql_query($sql_query);

if (MemberID == $SessionUserID)

  { $SetFlagName = '1' }

else

  { $SetFlagName = '0' }

 

It seems so easy, a caveman could do it.

 

Thanks,

Stan

Link to comment
Share on other sites

$sql_query = "SELECT `MemberID` FROM `Photographs` WHERE Approved = '1'";
$result = mysql_query($sql_query);
list($MEMBERID) = mysql_fetch_array($result);
if ($MEMBERID == $SessionUserID)
  { $SetFlagName = '1' }
else
  { $SetFlagName = '0' }

Should work.

Although that technically won't work because you're not cycling through the records

Link to comment
Share on other sites

When a member is loged on ($SessionUserID), I want to search thru a table (Photographs), to find if they (MemberID), has any active photos (Aproved = 1).  If so, then I want to set a variable ($whatever) to 1, or if not, then $whatever=0.  I want to use $whatever later on to enable additional features.

 

Stan

 

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.