Hi, Max, is it bug? when I try to build a where statement - access IN {data:access_levels} I get an array in Quotes and double quotes?
[access_levels] => Array ( [0] => 11 [1] => 12 [2] => 13 [3] => 7 [4] => 14 [5] => 9 [6] => 8 [7] => 10 [8] => 6 )
[read_data4] => Array ( [********] => SELECT * FROM `` WHERE access IN ["'11'","'12'","'13'","'7'","'14'","'9'","'8'","'10'","'6'"] [returned] => ( ) ) )
array values are auto converted to json encoded array by default, which is what you have here
you will need to use PHP to build the IN array(you can run PHP code in the WHERE box), or wait for the next update and use {data.in:access_levels}
Max,
I have already created an array in PHP - [access_levels] -
and I’m using it in an IN
clause for a database query.
The issue is that this IN
array contains both single and double quotes:
["'11'", "'12'", "'13'", "'7'", "'14'", "'9'", "'8'", "'10'", "'6'"]
As a result, the IN
clause isn’t working correctly.
In CF6, I resolved this by converting the array into a format suitable for the IN
query using the {val:}
placeholder and placing the resulting values in DATA
.
In CF8, this workaround didd not seem necessary anymore. Should I apply the same approach, or is there a better way to handle this in CF8?
Hi Elita
The IN array should be like this:
('11', '12', '13')
You can build this and use it OR wait for the next update and use
{data.in:access_levels}
if you have another solution which works then you can use it of course