I'm not that experienced with MySQL, but I thought I knew enough to do what I need this time. But I'm getting completely unexpected results and can't figure out the problem.
Here's the query I'm using:
SELECT channels.name, channels.description, categories.name, categories.description FROM channels, categories WHERE channels.title='$var' OR categories.title='$var'
$var contains a string that will be the 'title' of either a channel or a category. The query is intended to check both tables and return the applicable row from whichever table it finds a match for $var in the 'title' field. There are no duplicate 'title' field values between the two tables.
The actual results I'm getting are a full list of all rows in whichever table it shouldn't have found a match in at all. In other words, when $var should match a single row in the 'channels' table, the query actually returns ALL rows in the 'categories' table, and vice-versa.
What do I need to modify to get the expected results?
Thanks for any ideas,