GET array for use with IN clause of custom query action

@George and @patrick,

Thanks, this was very helpful.

For anybody needing to do this in the future, here is what will work inside a wappler custom query:

I found you can use the mysql find_in_set function in lieu of the IN clause. It should be noted that this shouldn’t be used on large sets as the performance will degrade.

find_in_set(cast(distro_tags.tag as char), :P4)

In my example this adds a WHERE condition requiring the tag field from the distro_tags table to be one of the entries in the P4 parameter, which is a string representation of a numeric array.

The parameter can be passed directly from the $_GET variable into the sql statement since it natively has no white space. If creating your own, the format is value followed by a comma without any white space (or it will break.)

Solved!

9 Likes