[eluser]Evollution[/eluser]
for example my
controller
Code:
function create(){
$this->load->library('form_validation');
// field name, error message, validation rules
$this->form_validation->set_rules('name', 'Title', 'trim|required|min_length[4]|xss_clean');
$this->form_validation->set_rules('autoplayon', 'Autoplay ON', 'trim|required');
$this->form_validation->set_rules('autoplayoff', 'Autoplay OFF', 'trim|required');
if($this->form_validation->run() == FALSE)
{
$this->load->view('admin/add');
}
else
{
$data = array(
'name' => $this->input->post('name'),
'slug' => url_title($this->input->post('name'),'dash', TRUE),
'autoplayon' => $this->input->post('autoplayon'),
'autoplayoff' => $this->input->post('autoplayoff'),
'autor' => $this->MyBBI->mybb->user['username']
);
$this->radio_m->add_record($data);
$this->index();
}
and my model
Code:
function add_record($data){
// insert
$this->db->insert('radio', $this->db->escape($data));
$return;
I done it corectly ?