Hi,
I created two textbox, how do I use the Custom Server Side Validation to ensure that it's the value entered is already in the database or not 😟
I created two textbox, how do I use the Custom Server Side Validation to ensure that it's the value entered is already in the database or not 😟
I use this code but ..😟
<?php
$i=0;
$db =& JFactory::getDBO();
$req = "SELECT cne from enregistrement";
$resultat = $db->query($req);
while ($row = $resultat->fetch()) {
if($row['cne']==$form->data['cne']) {
$form->validation_errors['cne'] = 'cne existe déja';
$i++;
}
}
if ($i) {
return false;
}
?>
Hi juki,
It looks as though you switched from Joomla! DB code to PHP DB code and the two don't join up properly
Bob
It looks as though you switched from Joomla! DB code to PHP DB code and the two don't join up properly
<?php
$db =& JFactory::getDBO();
$query = "
SELECT COUNT(*)
FROM `enregistrement`
WHERE `cne` = '{$form->data['cne']}' ;
";
$db->setQuery($query);
$resultat = $db->loadResult();
if ( $resultat ) {
$form->validation_errors['cne'] = 'cne existe déja';
return false;
}
?>
Bob
This topic is locked and no more replies can be posted.