editing database |
[eluser]maniac[/eluser]
Lots of problems learning this, but is fun, especially when I get it to work Need to edit my database, but keeps looking for a file that isn't in existence, causing an error. My code, maybe someone can see what I have done wrong (after 2 hours I can't!!) - Controller - function editemployee() { $data['title']="Edit An Employee"; $data['heading']="Employee Skills Database"; $data['pageheading']="Edit An Employee In The Database"; $this->db->where('empid', $this->uri->segment(3)); $data['query']=$this->db->get('employee'); $this->load->view('editemployeeview', $data); } function updateemployee() { $data=$_POST; $this->skillsmodel->updateemployee($data); header("Location: http://localhost/aStage2CI/index.php/skills/employee"); } Model - function updateemployee($data) { $this->empid=$data['empid']; $this->empfirstname=$data['empfirstname']; $this->emplastname=$data['emplastname']; $this->deptid=$data['deptid']; $this->db->update('employee', $this, array('empid'=>$data['empid'])); } View - <div id = "content"> <h1 align="center"><?=$pageheading?></h1> <br /> <?=form_open('employee/updateemployee');?> <?=form_hidden('empid',$this->uri->segment(3));?> <p>Employee First Name: <br /> <input type="text" name="empfirstname"></p><br /> <p>Employee Last Name: <br /> <input type="text" name="emplastname"></p><br /> <p>Department:<br /> <input type="text" name="deptid"></p><br /> <p><input type="submit" name="submit" value="submit"></p> </form> </div> Thanks |
Messages In This Thread |
editing database - by El Forum - 04-16-2010, 09:37 PM
editing database - by El Forum - 04-17-2010, 12:12 AM
|