Log in

View Full Version : Error in mysql query with array value



vinpkl
04-24-2015, 07:09 AM
Hi

I did explode on price range values.

It gave me two values.

But I am not able write those values in mysql query.

How will i write query with those two exploded values



$query = "select * from table where price BETWEEN $pricerange[0] and $pricerange[2]";


This is giving me error

Thanks
Vineet

jscheuer1
04-24-2015, 02:02 PM
I don't know all of what you're talking about. But are you sure you want to skip [1]? You said you have two values. Unless [1] is a garbage value or otherwise to be ignored, perhaps [2] is undefined. Also check for proper spelling of $pricerange, if that's misspelled/spelled differently here compared to where it's first made and/or used at a prior point to this, that could be a problem

If none of that's it, please post the error you're getting - it might help me or another figure this out.