Welcome Guest, Not a member yet? Register   Sign In
Delete a column from a database
#3

[eluser]zend[/eluser]
I dont understand how to use this?? Is dont work with me..

My Controoller
Code:
public function delite_page($id)
{
   $this->Page_Model->delitePage($id);  
   $rows_to_delete = $this->input->post('item');      
   redirect('page/', 'refresh');      
}

Model
Code:
public function delitePage($id)
{
  $this->db->where('id', $id);
  $this->db->delete('pages');
}

View
Code:
SCRIPT LANGUAGE=JavaScript  
$('#delete').click(function() {

    var rows_to_delete = $('107').serilize();

    $.post('page/delite_page/', rows_to_delete, function(data) {
        // Do some cool stuff like remove the rows
    });

});  
/SCRIPT

<a href="page/delite_page/"> Delete </a>

&lt;?php foreach ($query as $row):?&gt;
<tr>
   <td>&lt;input type="checkbox" name="item[]" value="&lt;?php echo $row-&gt;id; ?&gt;" /></td>
   <td>&lt;?php echo $row->id;?&gt;</td>
   <td>&lt;?php echo $row->title;?&gt;</td>
   <td>&lt;?php echo $row->author;?&gt;</td>
   <td>&lt;?php echo $row->parent;?&gt;</td>
   <td>&lt;?php echo $row->date_created;?&gt;</td>
</tr>
&lt;?php endforeach?&gt;

Dont work i dont know whay? Please help me i dont udnerstand.
Sorry my English is bad.


Messages In This Thread
Delete a column from a database - by El Forum - 02-11-2011, 04:05 PM
Delete a column from a database - by El Forum - 02-11-2011, 06:43 PM
Delete a column from a database - by El Forum - 02-12-2011, 07:09 AM
Delete a column from a database - by El Forum - 02-12-2011, 12:25 PM
Delete a column from a database - by El Forum - 02-12-2011, 12:54 PM
Delete a column from a database - by El Forum - 02-12-2011, 03:14 PM



Theme © iAndrew 2016 - Forum software by © MyBB