Board index   FAQ   Search   Register  Login  Function within
query statement?  Ask about general coding issues or problems
here.  Moderators: macek, egami, gesf  Postby Hurkle » Wed Feb
05, 2003 1:50 pm  I don't know how to do exactly what you
described, but here's an idea for you.  If you have a function
that can calculate the distance between 2 zips, then you must
have some way of getting positional data for a particular zip. I
would add 2 columns to your zip code table, i.e. fld_zip_x,
fld_zip_y. Write a script to calculate the x and y locations for
each zip, and store that in the table. Then when it's time to
build your query, your just doing a simple math operaration,
rather than calling a custom function.  It sounds like you're
going to have to do a join of some kind as well..  $str_sql =
"select tbl_users.* FROM tbl_users LEFT JOIN tbl_zips ON = WHERE
(tbl_zips.fld_zip_x - " . $user_zip_x . "< ' " . $within . " ' )
AND (tbl_zips.fld_zip_y - " . $user_zip_y . "< ' " . $within . "
' ) "  that should get