I'm working on a project from school. I want to be able to search for a term across multiple tables in a database. For ex. I have two tables(table a, table b) set up the exact same way, when someone searches for the term on the search box, I want the results to come from both tables(table a, table b).
Here is a snippet of my code. This only shows that it's searching one table within the database which is 'articles' , anyone know a way I can search both articles and articles 2 (my second table)?
BTW I looked at join, which seems to be for information that is different but goes together, I think I need union but honestly not sure how to get the syntax right.
Expand|Select|Wrap|Line Numbers
- $results = "SELECT `title`, LEFT(`description`, 70) as `description`, `url` FROM `articles` WHERE $where";
- $results_num = ($results = mysql_query($results)) ? mysql_num_rows($results) : 0;