In my database, I have two tables: Replies and Threads.
I'm trying to make a Contributions page showing what threads users have started or replied to.
Inside Replies are "ThreadId" and "Poster" which specify the Id of the thread it was replied to, and each row in Threads has an Id column as well as a "Poster" column.
I'm trying to make a query to get the rows of all THREADS in which a user has either posted or posted in.
Example:
$myUsername = "Bob";
$q = mysql_query("SELECT * FROM `Threads` WHERE `Poster`='$myUsername'
OR (another query to find if they had a row in Replies matching `ThreadId`='$tid'
AND `Poster`='$myUsername')");
Thanks
You will need to use an IN clause to specify that the thread id should be in those returned by a query in the replies table. Something like this is I understand correctly the structure of your tables.