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
https://forums.phpfreaks.com/topic/81834-solved-check-for-photo-contributors/
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

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

 

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.