[eluser]Unknown[/eluser]
Hello Friens, I have 2 questions. First I have A table named like Type_Telephones with only 2 fields Id_Type_Telephone, Name.
This is my model
var $validation = array(
'nombre' => array(
'label' => 'nombre',
'rules' => array('required', 'trim','unique', 'alpha_dash', 'min_length' => 3, 'max_length' => 20),
));
This is my controller
$t = new tipo_telefono();
$id = $_REQUEST['id'];
$nombre= $_REQUEST['value'];
if(!$t->where('id_tipo_telefono',$id)->update('nombre',$nombre))
{echo "{success:false,errors:'".$t->error->nombre."'}";return;}
echo "{success:true}";
}
The insert is good and take validation rules but when I want Update no take validation rules??
For example the min 3 characters.
And the second question the save and update is good, but when i want delete not delete this is my code, if I execute the sentence in sql this yes have functionality. Thanks
$t = new tipo_telefono();
$id = $_REQUEST['id'];
$t->where('Id_Type_Telephone',$id)->get();
$t->delete();