Can't get whereIn to work
tomkeysers opened this issue · comments
Tom K. commented
I'm trying to filter on a key that returns an array of colours, but I can't get it to work.
Example of data:
$result = Array
(
[0] => Array
(
[Art nr] => 2094
)
[1] => Array
(
[Art nr] => 0480C
)
[2] => Array
(
[Art nr] => 1576
)
[3] => Array
(
[Art nr] => 2619
[Colour (website)] => Array
(
[0] => Brown
)
)
[4] => Array
(
[Art nr] => 1449
)
[5] => Array
(
[Art nr] => 3252
)
[6] => Array
(
[Art nr] => 2618
[Colour (website)] => Array
(
[0] => Brown
)
)
[7] => Array
(
[Art nr] => 3029
[Colour (website)] => Array
(
[0] => Brown
)
)
)
My code:
$jsonq = new Jsonq();
$jsonq->json(json_encode($result));
$res = $jsonq
->whereIn("Brown", "Colour (website)")
->get();
write_log($res);
But I get an empty array as a result.
I also tried switching the key and value in the command, like whereIn("Colour (website)", "Brown")
, but without result.
Another thing I tried is converting the colour field to json, so it becomes a 'flatter array' like this: [colour_website] => ["Brown"]
but that also doesn't work.
What am I doing wrong?
Nahid Bin Azhar commented
can you please give me the real data?