Hi i need check a record before insert to my database. For not have duplicate record on the table.
How its possible?? I try this
public function customers()
{
$crud = new grocery_CRUD();
$crud->set_table('db_clientes');
$crud->set_subject('Cliente');
$crud->display_as('iddb_estados','Estado de Cuenta');
$crud->set_relation('iddb_estados','db_estados','nombre_estado');
$crud->change_field_type('ultima_actualizacion','hidden',date('Y/m/d H:i:s'));
$crud->order_by('nombre_cliente');
$crud->required_fields('nombre_cliente');
[b] $crud->callback_before_insert(array($this,'check_customer'));[/b]
$output = $crud->render();
$this->load->view('back-end/module/mo_customers', $output);
}
Check record before insert
Started by rdroguett, 22 June 2012 - 08:39 AM
- Single Page
Posted 22 June 2012 - 08:39 AM
Posted 22 June 2012 - 12:40 PM
If all you need is to avoid duplicates I suggest you create a UNIQUE KEY on MySQL.