Through the string $codear = $_POST ['codestring'];
data recovery, in json format, coming from a form. It returns me the following string array.
Array
(
[0] => 1071bf
[1] => 19d7f9
[2] => 16d78f
[3] => 110bf5
[4] => 10731e
[5] => 107155
[6] => 107124
[7] => 114c25
[8] => 1398c4
[9] => 189b95
[10] => 137521
)
These are product codes that I would like to use in a SELECT with condition, such as:
SELECT * FROM products WHERE hotel_basic_price = $codear
Please note that this string varies in the number of products to each request sent by the user.
I also tried to use json_decode, in the form $json = json_decode($codear, true);
but I get an error of json_decode() expects parameter 1 to be string, array given in
.
How should I handle this string in my Select?