Chronoforms V5 Check if email address already exist

giusebos 18 Feb, 2016
I'm trying to do a background check on an email field, the table where the email is "visualizza_lista" con 2.
It contains two tables: id, email, region.
I read this post and I used the code attached
http://www.chronoengine.com/forums/posts/f2/t23171.html

unfortunately the email although there is again recorded
Here you can try the form
http://formlab.progetto.ovh/component/chronoforms5/?chronoform=visualizza_lista

the code is this and it is added to server validatione>>email

<?php
$db =& JFactory::getDBO();
$query = "
SELECT COUNT(*)
FROM `visualizza_lista`
WHERE `email` = '{$form->data['email']}' ;
";
$db->setQuery($query);
$count = $db->loadResult();
if ( $count ) {
$form->validation_errors['email'] = "Questa email è già registrata.";
return false;
}
?>


my setup:
GreyHead 18 Feb, 2016
Hi giusebos,

The code looks Ok to me - I suggest that you add some output lines to see exactly what is happening. I'd probably echo out $query and $count to see exactly what is there.

Bob
This topic is locked and no more replies can be posted.