Welcome Guest, Not a member yet? Register   Sign In
Delete Function works but white screen during execution
#1

[eluser]Unknown[/eluser]
Hello:

First post. If I posted in the wrong place, let me know. The code below works as intended however, I get a white screen during execution. Once it is finished, the row is removed and the redirect works fine. Is this correct or have I written something to cause that? Also, if there is a better way to write this, let me know.

Thanks in advance!!

Rich Halsey

public function delete($id)
{

$this->db->from('users');
$query = $this->db->get();
$rowcount = $query->num_rows();

if ($rowcount == 1)
{
$this->session->set_flashdata('message', '<div id="errors"> You must have one user in the database!</div>');
redirect('admin/users', 'refresh');
}


else
{


$this->db->where('id', $id);
$this->db->delete('users');

$this->session->set_flashdata('message', '<div id="success"> The user was deleted from the database successfully!</div>');
redirect('admin/users', 'refresh');

}
}




Theme © iAndrew 2016 - Forum software by © MyBB