Query help
3 posts by 2 authors in: Forums > CMS Builder
Last Post: February 26, 2021 (RSS)
Hi there, need some help with a record lookup query:
$geoid = "AU";
// load record from 'banners'
list($bannersRecords, $bannersMetaData) = getRecords(array(
'tableName' => 'banners',
'where' => "`country_code` LIKE '". mysql_escape($geoid) ."'",
'loadUploads' => false,
'allowSearch' => false,
'limit' => '1',
));
$bannersRecord = @$bannersRecords[0]; // get first record
country_code has a list of id's in it separated by comma's like this:
AU,NZ,US
What should I use for 'where' =>
Many thanks :)
By Djulia - February 25, 2021
Hi Theclicklab,
Can you try this ?
$geoid = "AU";
// load record from 'banners'
list($bannersRecords, $bannersMetaData) = getRecords(array(
'tableName' => 'banners',
'where' => "FIND_IN_SET('". mysql_escape($geoid) ."', `country_code`)",
'loadUploads' => false,
'allowSearch' => false,
'limit' => '1',
));
$bannersRecord = @$bannersRecords[0]; // get first record
Thanks,
Djulia