I'm doing a basic add user form for work and I'm trying to add a user to the database however when I try I just get the primary key is being duplicated error. Pretty sure the solution is looking me right in the face but I've hit a wall today lol.
database table struture
dbo.ci_users
id(PK, int, not null)
user_name(nchar255, not null)
user_email(nchar255, not null)
user_password(nchar255, not null)
user_displayname(nchar255, not null)
user_active(smallint, not null)
user_level(smallint, not null)
Adduser_model
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class adduser_database extends CI_Model {
         function __construct()
        {
            // Call the Model constructor
            parent::__construct();
            $this->load->database();
        }
    public function insert_into_db()
    {
        $data = array(
            'id'            => '0',
            'user_active'        => '1',
            'user_level'         => '2',
            'user_displayname'   => $this->input->post('user_displayname'),
            'user_email'         => $this->input->post('user_email'),
            'user_name'      => $this->input->post('user_name'),
            'user_password'      => $this->input->post('user_password') 
        );
        $this->db->insert('ci_users', $data);
    }
}
 
     
     
     
    