Forums

check entry name - name duplicated

giusebos 15 Feb, 2016
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 ..
This topic is locked and no more replies can be posted.