Let me explain in detail:
I have a html form which asks the user for country,state,city,zip_code
I will use these values to query the database for specific data for those specific inputs.
I want the city and zip_code to be logicly use as OR. Meaning that the user only needs to select a city or type the exact zip_code. Either one should still be able to grab the data from the database.
Here is the code I used:
Code:
Expand|Select|Wrap|Line Numbers
- SELECT *
- FROM postings
- WHERE state ='".$state."' AND Country ='".$country."'
- AND city ='".$city."' OR zipcode ='".$zipcode."'
- AND item ='".$item."'
- LIMIT $s,$limit"
when I tried that code concept. I get a white screen with an error saying the syntax is wrong where limit starts at.
The query is supposed to grab all data based on that users form inputs. I am creating a paging effect. That is why I use the limit code.
Yet I want the user to input either the city name or zip_code.
how should I be doing this? I played around with the code but got nothing right now.
Currently the code only works when you input the country,state,city name. It won't allow to have the city name blank and use a zip code.