Note that there are some explanatory texts on larger screens.

plurals
  1. PODatabase Error: Duplicate Entry
    primarykey
    data
    text
    <p>The Error:</p> <blockquote> <p>A Database Error Occurred Error Number: 1062 Duplicate entry '0' for key 1</p> </blockquote> <pre><code>INSERT INTO `CCI_Faculty` (`Username`, `Password`, `LastName`, `FirstName`, `Title`, `Phone`, `Email`, `Office`, `Department`, `Biography`, `Website`, `CV`) VALUES ('terry12', 'feba90aa365c150fccecca6dc8024696', 'stewart', 'carl', 'dean', '778-990-0002', 'dea09@cci.edu', 'UCB771', 'IT', ' ', '', '') </code></pre> <p>My Code:</p> <pre><code>&lt;?php class CCI extends Controller { function CCI() { parent::Controller(); } function index() { $this-&gt;load-&gt;helper('url'); $this-&gt;load-&gt;view('Users/login'); } function register() { $this-&gt;load-&gt;helper('url'); $this-&gt;load-&gt;view('Registration/Register_Main'); } function cci_users() { $this-&gt;load-&gt;helper(array('form','url')); $this-&gt;load-&gt;library('form_validation'); if(isset($_POST['username'])&amp;&amp; isset($_POST['password'])&amp;&amp; isset($_POST['last_name'])&amp;&amp; isset($_POST['first_name'])&amp;&amp; isset($_POST['title'])&amp;&amp; isset($_POST['number'])&amp;&amp; isset($_POST['office'])&amp;&amp; isset($_POST['department'])); $this-&gt;form_validation-&gt;set_rules('username','Your Username', 'required|alpha_numeric|min_length[6]|max_length[44]'); $this-&gt;form_validation-&gt;set_rules('password','Your Password', 'required|alpha_numeric|min_length[12]|max_length[24]'); $this-&gt;form_validation-&gt;set_rules('last_name','Last Name', 'required|alpha_numeric'); $this-&gt;form_validation-&gt;set_rules('first_name','First Name', 'required|alpha_numeric'); $this-&gt;form_validation-&gt;set_rules('title','Job Title', 'required|alpha_numeric'); $this-&gt;form_validation-&gt;set_rules('number',' Phone', 'required'); $this-&gt;form_validation-&gt;set_rules('office',' Office', 'required'); $this-&gt;form_validation-&gt;set_rules('department',' Department', 'required'); if ($this-&gt;form_validation-&gt;run() === TRUE) { $this-&gt;load-&gt;model('CCI_Employee'); $data['rows'] = $this-&gt;CCI_Employee-&gt;cci_new_users($_POST['username'], $_POST['password'],$_POST['last_name'],$_POST['first_name'], $_POST['title'],$_POST['number'],$_POST['email'], $_POST['office'],$_POST['department'],$_POST['bio'], $_POST['website'],$_POST['cv']); $this-&gt;load-&gt;view('profile', $data); } else $this-&gt;load-&gt;view('Registration/Register_Main'); } function print_profile() { $this-&gt;load-&gt;helper('url'); $this-&gt;load-&gt;model('CCI_Employee'); $data['rows'] = $this-&gt;data_model-&gt;cci_new_users(); $this-&gt;load-&gt;view('profile', $data); } } /* End of file cci.php */ /* Location: ./system/application/controllers/cci.php */ </code></pre> <p>Other Page:</p> <pre><code>&lt;?php class CCI_Employee extends Model { function CCI_Employee() { parent::Model(); $this-&gt;load-&gt;database(); } function validate_users($username, $password) { $password = md5($password); $search_login = $this-&gt;db-&gt;get_where('CCI_Faculty', array('Username'=&gt; $username)); if($search_login-&gt;num_rows() &gt; 0) { if($password == $search_login-&gt;row()-&gt;password) return TRUE; else return FALSE; } else return FALSE; } function cci_new_users($username, $password, $last_name, $first_name, $title, $number, $email, $office, $department, $bio, $website, $cv) { $username = $this-&gt;input-&gt;post('username'); $password = md5($this-&gt;input-&gt;post('password')); $last_name = $this-&gt;input-&gt;post('first_name'); $first_name = $this-&gt;input-&gt;post('last_name'); $title = $this-&gt;input-&gt;post('title'); $number = $this-&gt;input-&gt;post('number'); $email = $this-&gt;input-&gt;post('email'); $office = $this-&gt;input-&gt;post('office'); $department = $this-&gt;input-&gt;post('department'); $bio = $this-&gt;input-&gt;post('bio'); $website = $this-&gt;input-&gt;post('website'); $cv = $this-&gt;input-&gt;post('cv'); $insert = $this-&gt;db-&gt;insert('CCI_Faculty', array('Username' =&gt; $username, 'Password' =&gt; $password, 'LastName' =&gt; $last_name, 'FirstName' =&gt; $first_name, 'Title' =&gt; $title, 'Phone' =&gt; $number, 'Email' =&gt; $email, 'Office' =&gt; $office, 'Department' =&gt; $department, 'Biography'=&gt; $bio, 'Website' =&gt; $website, 'CV' =&gt; $cv)); $this-&gt;db-&gt;select('FirstName, LastName, Title, Phone, Email, Office, Department, Biography, Website, CV'); $check_insert = $this-&gt;db-&gt;get('CCI_Faculty'); return insert; if($check_insert-&gt;num_rows() &gt; 0) { foreach ($check_insert-&gt;result()as $row) { $data[] = $row; } return $data; } } /** $user_info = "SELECT LastName, FirstaName, Department, Phone, Email, Office FROM CCI_Faculty WHERE LastName = ? AND FirstName = ? AND Department = ? AND Phone = ? AND Email = ? AND Office = ?"; $retrieve = $this-&gt;db-&gt;query($user_info, $new_users('last_name','first_name', 'department','number','website','office' )); if($retrieve-&gt;num_rows() &gt; 0) { foreach ($retrieve-&gt;result() as $row) { $data[] = $row; } return $data; } */ } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload