troubleshooting Question

Sorting parameter arrays and filtering mysql query

Avatar of b0byan
b0byan asked on
12 Comments1 Solution486 ViewsLast Modified:

I have an mysql query which need to be filtered by the values of an url parameter that looks like this: <url>?featuresId=18, 2, 50

I have the array below to sort my values:


$temp=explode(',', $HTTP_GET_VARS['featuresId']);
foreach($temp as $index=>$value)
$get_features_query = "select * from features where feature_name like '%|" . implode("|%|", $temp) . "|%'";


The thing is i need the query to be filtered by feature_name like this:

$get_features_query = "select * from features where feature_name like %|2|%|18|%|50|%;

Any ideas how can i get to the bottom of this?

Join our community to see this answer!
Unlock 1 Answer and 12 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros