So, I think I figured it out but its still acting weird.
Depending on my data set, it passes or fails.
IE
I have a user (found from the first query) that will need 4 searches performed.
the second search works on locations. a region (USA, CANADA, etc) and then a list of cities in each region. The second query takes information from the first and generates a list of locations (by city) to run a search.
IE
-Name- -region- -search criteria-
john smith CANADA blah blah blah
john smith CANADA yadda yadda yadda
john smith USA blah blah blah
john smith CANADA yap yap yap
So, it takes the search criteria and applies to to the 15 city locations in CANADA from another select statement. then writes out the data from the search and goes to the next record. Repeats the process and goes on. I did it this way so I could enter all my search information in one table and just run the search by user.
If I run the code using CANADA as the region (about 15 cities) the script loops through everything just fine and creates the output exactly as needed.
If I then run it for USA (about 130 cities) if will get through the first then fail when trying to do the next inner loop (select statement to grab USA cities)
So, in the case using the example data above, the first three will run fine and then when the query goes back to grab the locations for the fourth CANADA search, it will fail (meaning that the USA worked, but then failed trying to grab the final CANADA location). If I take out the USA search, it all works.
So, I guess my question is why would a large data set cause the following query to fail? Is it timing out? Running out of memory?
I added a "mysql_free_result" in the loop when I was done with the location array (before it got filled again) thinking that it was a memory issue.
I am completely stumped.