alright, I've been banging my head against this query for the past couple of days. Here's the deal, I hope I don't confuse you too much trying to explain this. I have 3 tables(listed below). Table 1 has general site login crap, table2 has application specific info(there will be more of these later), and table3 has information that has been used already.
Every email in table2 will be in table1, but not neccessarily the other way around. Table3 is organized so after a user selects an item, that item is populated in table3 with the user's email and the code of the product selected.
Example: firstname.lastname@example.org is signed up for the app, so he has an entry there. He has already selected several codes, so he has a few entries in table3. The tables might look something like this now:
Using this, I'm hoping to display table2 items who's catagory matches the user's AND who's code is not listed in table3 next to the user's email. So, if joe were logged in, it would display items: email@example.com cat1 333333 firstname.lastname@example.org cat1 666666
This is what I've got right now. I know the third statement( $query .= "AND '$email'!=`$table2`.email "; ) is one of the problems. I'm not even sure if it is possible with this setup, so if need be, I'd even be willing to reorganize the tables...just keep in mind that down the road other apps will be added, and they will get their own table2 and table3.
...run code to get logged in user's information and set to $email, $category, and $code...
$query = "SELECT * FROM table1, table2, table3 ":
$query .= "WHERE '$category'=`$table2`.faction ";
$query .= "AND '$category'=`$table2`.faction ";
$query .= "AND '$code'!=`$table2`.code ";
$query .= "AND '$email'!=`$table2`.email ";
Any ideas? I'm a bit of a mysql noob...but I google well in most cases!