Jump to content

Left Join Help


phpretard

Recommended Posts

One county can have 50 zipcodes.  Well if I only have one county in the MEMBERS TABLE i would like to show up for any of the 50 zipcodes when the zipcode is searched.

 

If you look at SAINT THOMAS as the County it has several zipcodes (I am reffering to the attachment).

 

Remmber: I am searching the MEMBERS table...it has the counties only and they are comma seperated.

The ZIPCODE table (attached) has the counties listed multiple times for each zipcode.

 

Here is my current search:

$mainSearch=$_POST['mainSearch'];

$result = mysql_query("SELECT * FROM members WHERE (City='$mainSearch' OR State='$mainSearch' OR ZipCode='$mainSearch' AND $service='1') AND PaidID!='' ORDER by id");

$num_rows = mysql_num_rows($result);

if ($num_rows > 0){

while($row = mysql_fetch_array($result))
{ RESULT }

 

 

Just as an example if I search the MEMBERS table for ZipCode 00801 - 00805 I would like to somehow cross references the ZIPCODE Table for a result.

 

I really think I need an expert in this one.  I have searched high and low.

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/119660-left-join-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.