[eluser]Unknown[/eluser]
I have the same problem, and then I try this
this is the view
Code:
<form action="insert_data" method="post">
Email : <input type="text" name="email">
<input type="submit" value="Submit">
</form>
this is the controller code
Code:
function insert_data()
{
//get the data from database to check whether the data that you've inserted is already exists or not
$check = $this->your_model->check_data();
if($check > 0) //if the data exists show error message
{
//write the error message
}
else //if the data is not exists, save the data
{
$this->your_model->save_data();
}
}
and this is the model
Code:
//the function to check whether the data inserted by user is already exists or not
function check_data()
{
$this->db->where('email', $this->input->post('email'));
$query = $this->db->get('table');
return $query->num_rows();
}
with this, you don't have to set the database config
Code:
$db['default']['db_debug'] = TRUE
to
Code:
$db['default']['db_debug'] = FALSE
#sorry if my english is bad, I hope this will help

+