Buy Now
Sign in

check entry name - name duplicated

giusebos , February 15 2016
g
giusebos

I would check that your entry is not already in the database
My Forms:
in design
textbox (field name e field ID = marca)
submit button

in setup
On load
HTML (render Form)

On Submit
event switcher
DB save
Display message

code php in event switcher

				
<?PHP
$db =& JFactory::getDBO();
$query = "
SELECT COUNT(*)
FROM `marcheAutomezzi`
WHERE `marca` = '{$form->data['marca']}' ;
";
$db->setQuery($query);
$count = $db->loadResult();
if ( $count ) {
$form->validation_errors['marca'] = "nome prersente.";
return false;
}


my table 2 field:
idmarca, marca

I can not do any checking of the name ..