Jump to content

Recommended Posts

Hello, I was wondering if someone may be able to help with a problem. I am trying to make a query work and I am having troubles doing so. I would like to JOIN to databases by the zip code column in each and also have the query perform a search on text I entered in. I am putting the end result into PHP, but I am just having trouble with the code.

 

The below code works fine to bring back a general query with all records on it.

 

select consumer.email, zip.county FROM consumer, zip WHERE consumer.zip = zip.zip

 

How would I specify that I just want one zip code on the above query? I tried using LIKE 33764, but it does not work. Also, the code below is what I would like the above code to look like, the only difference is that the above would be joining 2 tables.

 

select * from state WHERE MATCH(county) AGAINST ('%$trimmed%' IN BOOLEAN MODE)

order by county

 

Any help on this would be greatly appreciated.

 

Jason

Link to comment
https://forums.phpfreaks.com/topic/44624-solved-mysql-join-and-search/
Share on other sites

Well, I got the answer and I got it to work. Now I am adding a BETWEEN to the end of it and it is pulling back random results that are not right. Am I doing something wrong?

 

select consumer.email, zip.county FROM consumer, zip WHERE consumer.zip = zip.zip

and MATCH(zip.county) AGAINST ('%$trimmed%' IN BOOLEAN MODE) AND consumer.income BETWEEN '$trimmed2' AND '$trimmed3'

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.