Question

I'm using a jQuery range slider for a price range, but even with explode() I can't separate the two prices (min and max) so I can use them with MySQL BETWEEN. Is there any way to do fix it (or a better way to pass data in to a query)?

At the end I would like to have two strings ($price_min & $price_max) so it is easy to use them.

Now it looks like this:

β¬500 - β¬878

However should be more like this:

€500 - €878

but the euro sumbol seems to have a problem.

Était-ce utile?

La solution

I am not sure why explode isn't working for you, here it is working: https://eval.in/94159

$string = "β¬500 - β¬878";

$ary = explode("-",$string);

$min =  filter_var($ary[0], FILTER_SANITIZE_NUMBER_INT);
$max =  filter_var($ary[1], FILTER_SANITIZE_NUMBER_INT);

echo "between " . $min . " and " .$max;
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top