and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi
I am trying to create a query that takes a members ID looks up past images they have submitted and the locations they are from. It then uses these locations to find further images of the particluar locations submitted by other members.
Am having a little trouble writing this query
so far I have
[syntax="php"]$result = mysql_query("Select * from plogger_pictures INNER JOIN pubs on plogger_pictures.location_id = location.location_id where plogger_pictures.member_id = '$member_id'")
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
SELECT pictures
FROM plogger_pictures
WHERE location IN (SELECT location
FROM plogger_pictures
WHERE member_id = '$member_id')
AND member_id <> '$member_id'
The AND clause will make sure the member gets pictures they didn't take - that was my assumption as to where you were going with this idea. I threw quotes around member_id 'cause I wasn't sure what the datatype would be.