NYCPHP Meetup

NYPHP.org

[nycphp-talk] Multiple query from out put

Brian O'Connor gatzby3jr at gmail.com
Mon Sep 19 18:24:52 EDT 2005


If you're storing the address of the stores in seperate rows, where zip code 
is its own row you could do something like this:

$query = "SELECT stores.* FROM stores, zip_codes WHERE stores.zip = 
zip_codes.value AND zip_codes.value = '$zip_code';";

Obviously you need to replace the tables / structure with what you have in 
place.

Also, you could just do "SELECT * FROM stores WHERE zip_code = 
'$zipcode'';";

Also, if you're wondering about the multiple queries with the return from 
the first query that you mentioned, you can use a while loop when assigning 
the value of mysql_fetch_array, which then handles all the results from the 
database with the code included within the while loop.

Hope that helps (and sorry if I was confusing).

On 9/19/05, thegeek <thegeek at thecolorgeek.com> wrote:
> 
> Well need some guidance here. Pretty much a beginer. Here is what I would
> like to do. I have a script that searches a table within the database and
> returns multiple enteries(zip codes) in that table. I would then like to
> take each one of zipcodes and search another table for store addresses. So
> am unsure how to format to make multiple queries from the original zipcode
> search. I can query the database (MySQL) with a single zip and get what I
> need but don't know where to start when to repeat that with a multiple
> query. This is a volunteer non profit project with no money and no real
> deadline so a good opportunity for me to learn.
> 
> Paul G
> _______________________________________________
> New York PHP Talk Mailing List
> AMP Technology
> Supporting Apache, MySQL and PHP
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.nyphp.org
> 



-- 
Brian O'Connor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20050919/5e037508/attachment.html>


More information about the talk mailing list