|
| |
How to display results matching a comma delimited list variable...help please!
View related threads:
(in this forum
| in all forums)
|
Logged in as: Guest
|
|
|
jonance
Posts: 298 From: Louisville KY USA Status: offline
|
How to display results matching a comma delimited list ... - 1/16/2008 16:07:16
Hi, I really need some help on this as i'm wrapping up a website for a client. I have a backend set up so that they can divide a city up into different sections. For each section they choose to divide it up into, they are to add the zip codes that are contained in that area. They are to enter them separated by a comma like so: 40207, 40208, 40209 That comma delimited list is saved into a database field...now when a user searches a particular section, the zip codes are sent as a variable (Expr1000), however i cannot get it to produce any results. I am using the code below. If there is just one zip it works but any more than that it does not return results. In the above example it should return all listings for all 3 zips. Can anyone help me? Thanks in advance!
SELECT * FROM listings WHERE (zip LIKE '%::Expr1000::%' AND activated = 'yes') ORDER BY type ASC,realname ASC
< Message edited by jonance -- 1/16/2008 16:21:03 >
|
|
|
|
jonance
Posts: 298 From: Louisville KY USA Status: offline
|
RE: How to display results matching a comma delimited l... - 1/16/2008 17:04:53
Thanks for the reply Spooky... Yes, you pretty much got it. But it isn't the user entering it per say. It is the site owner. They will assign an area, say, West Louisville...the zip codes. So West Louisville could have the value for the zip code field like 40208, 40209, 40210 or something like that. When a user chooses West Louisville from a drop down, it will actually send the zips over as i typed them above as a variable. So i need the records that have a zip code that matches any of those to show up in the results. Of course it works for just one as that is normal...but i'm not sure how to handle the sql statement so it splits those up at the comma and space and makes them like an OR statement. Hopefully you see what i'm getting at..i just don't know how to execute it. Thanks John
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|