davez
Member
Hi,
I found a little bug. I'm working on a solution, but haven't figured it out yet.
It happens on a failed validation in a repeat group where a databasejoin dropdown exists. I get the error:
Error: 1054
Unknown column 'Array' in 'where clause' SQL=SELECT DISTINCT(`wic_sites`.`id`) AS value, `sitename` AS text,REPLACE(`description`, ' ', '
') AS description FROM `wic_sites` AS `wic_sites` WHERE `wic_sites`.`id` IN (Array,Array,Array) ORDER BY text ASC
In looking in the code /plugins/fabrik_element/databasejoin/databasejoin.php there was some notes about this
Sometimes $v is an array two-levels deep, so when it implodes, there's still an array. This only seems to happen when it's reloading the page after a failed validation.
I found a little bug. I'm working on a solution, but haven't figured it out yet.
It happens on a failed validation in a repeat group where a databasejoin dropdown exists. I get the error:
Error: 1054
Unknown column 'Array' in 'where clause' SQL=SELECT DISTINCT(`wic_sites`.`id`) AS value, `sitename` AS text,REPLACE(`description`, ' ', '
') AS description FROM `wic_sites` AS `wic_sites` WHERE `wic_sites`.`id` IN (Array,Array,Array) ORDER BY text ASC
In looking in the code /plugins/fabrik_element/databasejoin/databasejoin.php there was some notes about this
Code:
if (is_array($v))
{
/**
* $$$ hugh - tweaked this a little, as IN () pitches an error in
* MySQL, so we need to make sure we don't end up with that. So as
* IN (), if it worked, would produce no rows, just replace with 1=-1
* Can't just count($v), as sometimes it's an array with a single null entry.
*/
$v = array_map(array($db, 'quote'), $v);
$ins = implode(',', $v);
if (trim($ins) === '')
{
$query->where('1=-1');
}
else
{
$query->where($key . ' IN (' . $ins . ')');
}
}