dimoss
Well-Known Member
Hi
I use the following code on a php form plugin to validate the record insertion on a table onAfterProcess:
However it seems that something is wrong as the real query should return > 0 which means 'false'.
Any help is appreciated.
Thanks
I use the following code on a php form plugin to validate the record insertion on a table onAfterProcess:
PHP:
$etos = $formModel->getElementData('fab_mitroo_elegktwn___etos', true);if (is_array($etos)) {$etos = $etos[0];}
$minas = $formModel->getElementData('fab_mitroo_elegktwn___minas', true);if (is_array($minas)) {$minas = $minas[0];}
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('COUNT(*)');
$query->from('fab_table');
$query->where('etos = '.$etos);
$query->where('minas = '.$minas);
$db->setQuery($query);
$number = $db->loadResult();
if ($number > 0)
{
return false;
}
else
{
return true;
}
However it seems that something is wrong as the real query should return > 0 which means 'false'.
Any help is appreciated.
Thanks