Welcome Guest, Not a member yet? Register   Sign In
Having problems with creating a CRUD..
#1

[eluser]ealonw[/eluser]
Hey CI's!!

Im having problems creating an update and delete function... Take look at my controller and view files and see if you can spot the errors for me..

Here are the problems:

1. the EDIT link doesnt populate the view form 'update_contact_view'
2. the DELETE removes all entries in database and NOT the selected entry... so if you are
interested in wiping out your database you can definitely use this code.. LOL!

Any brains out there that can help me correct the syntax?





*******CONTROLLER-->Contact**********
function update()
{

$data = array(

$this->input->post('fname') => $fname,
$this->input->post('lname') => $lname,
$this->input->post('email') => $email,
$this->input->post('comment') => $comment,



);

$this->db->where('fname', $fname);
$this->load->view('update_contact_view');
}



function delete()
{
$this->db->delete('usercomment', array('id' => $id));
// Produces: DELETE FROM usercomment WHERE id = $id

}

}

*********VIEW-->update_contact_view.php**********
<HTML>
<HEAD>
<TITLE>Update</TITLE>
</HEAD>
<BODY>

<?php echo form_open('contact/update'); ?>
<table border="0">
<tr><td>First Name:</td><td>
&lt;input type="text" name="fname" maxlength="20" value="&lt;? echo "$fname"; ?&gt;"&gt;
</td></tr>
<tr><td>Last Name:</td><td>
&lt;input type="text" name="lname" maxlength="20" value="&lt;? echo "$lname"; ?&gt;"&gt;
</td></tr>
<tr><td>Email:</td><td>
&lt;input type="text" name="email" maxlength="50" value="&lt;? echo "$email"; ?&gt;"&gt;
</td></tr>
</table>
<br><br>
&lt;textarea name="comment" cols="40" rows="5" value="&lt;? echo "$comment"; ?&gt;"&gt;
&lt;/textarea&gt;<br><br>
&lt;input type="submit" name="submit" value="submit"&gt;
&lt;/form&gt;
<br>
<br>
<DIV ALIGN=CENTER>



&lt;/form&gt;
</DIV>
&lt;/BODY&gt;
&lt;/HTML&gt;


Messages In This Thread
Having problems with creating a CRUD.. - by El Forum - 06-05-2008, 12:03 PM
Having problems with creating a CRUD.. - by El Forum - 06-05-2008, 12:22 PM
Having problems with creating a CRUD.. - by El Forum - 06-05-2008, 05:14 PM
Having problems with creating a CRUD.. - by El Forum - 06-06-2008, 11:26 AM
Having problems with creating a CRUD.. - by El Forum - 06-06-2008, 11:34 AM
Having problems with creating a CRUD.. - by El Forum - 06-06-2008, 11:38 AM
Having problems with creating a CRUD.. - by El Forum - 06-06-2008, 11:46 AM
Having problems with creating a CRUD.. - by El Forum - 06-06-2008, 12:01 PM
Having problems with creating a CRUD.. - by El Forum - 06-06-2008, 12:16 PM
Having problems with creating a CRUD.. - by El Forum - 06-07-2008, 01:58 AM
Having problems with creating a CRUD.. - by El Forum - 06-10-2008, 12:45 PM
Having problems with creating a CRUD.. - by El Forum - 06-10-2008, 01:01 PM
Having problems with creating a CRUD.. - by El Forum - 06-10-2008, 02:22 PM
Having problems with creating a CRUD.. - by El Forum - 06-10-2008, 02:54 PM
Having problems with creating a CRUD.. - by El Forum - 06-10-2008, 03:22 PM
Having problems with creating a CRUD.. - by El Forum - 06-10-2008, 03:47 PM
Having problems with creating a CRUD.. - by El Forum - 06-11-2008, 04:50 PM
Having problems with creating a CRUD.. - by El Forum - 06-11-2008, 05:57 PM
Having problems with creating a CRUD.. - by El Forum - 06-12-2008, 10:09 AM
Having problems with creating a CRUD.. - by El Forum - 06-12-2008, 12:33 PM
Having problems with creating a CRUD.. - by El Forum - 06-12-2008, 02:52 PM
Having problems with creating a CRUD.. - by El Forum - 06-12-2008, 08:50 PM



Theme © iAndrew 2016 - Forum software by © MyBB