WHERE Not in list

3 posts by 2 authors in: Forums > CMS Builder
Last Post: September 23, 2020   (RSS)

By ciaranmac - September 22, 2020

I have ran into some issues with a where clause. I am doing some AND calls, but I now I want to do another call to exclude items that are in the list returned in $ExcludeItems. I have tried this:
$ExcludeItems = 110, 98

AND num NOT IN ('$ExcludeItems')

But it doesn't work for me. For some reason it is only excluding the first in the list. Can anyone shed some light? Below is the full call.

list($productsRecords, $productsMetaData) = getRecords(array(
'tableName' => 'products',
'where' => "product_location = '$CurrentLocation' AND product_category like '%$CurrentCID%' AND num NOT IN ('$ExcludeItems')",
'orderBy' => "title ASC",
'loadUploads' => true,
'allowSearch' => false,
))
Cheers,
Ciaran

By ciaranmac - September 23, 2020

Hi Djulia,

That worked for me. Thanks very much for replying.

Cheers,

Ciaran