I am stumped!
It looks like I need to make 3 queries, and I would like them to appear as one event to the end user. Near as I can gather from the manual and tutorials is I want to do this with either a loop or temp tables. I can't find enough solid information for either. I am using MySQL and php3. Here is what I am trying to do:
Query 1- SELECT * FROM zip
$long and $lat are returned and simple arithmatic applied using php3, resulting in $long_1,$long_2,$lat_1,and $lat_2.
Query 2- SELECT * FROM zip WHERE longitude BETWEEN $long_1 AND $long_2 AND latitude BETWEEN $lat_1 AND $lat_2;
This will provide several rows and what I need for the final query, I tried several ways of joining tables to combine query 2 and 3 but never worked.
QUERY 3- SELECT * FROM category JOIN ad WHERE ad.cat_id=category.id GROUP BY ad.cat_id HAVING ad.zip='$zip';
Have I lost myself by rewriting this so many times? Is my syntax goofed?
I don't understand how to go about making multiple queries, are these seperate connections? Can I just write one after another in PHP and they are carried out?
Thanks in advance