SELECT * FROM `table1` UNION ALL SELECT * FROM `table2` ORDER BY `date` desc
#1) when i am getting the data using mysql_fetch_array, how can i tell which table the row is from?
#2) how can i get everything to order by `date` desc? like right now, that does order it by date desc, except it does the 1st table 1st, the 2nd table 2nd.
You can't tell which table it's from, if they have the same field names. If they have different field names, then it will be easy to tell which table it's from. If they have the same field names, you can use column aliases to bypass that.
To order by date, put your (SELECT ...) in parenthesis (both of them), but not the union keyword.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.