01-27-2009, 04:35 PM
[eluser]Unknown[/eluser]
Hey Guys
I apologise for this question in advance as most of you guys probably find it insultingly obvious but I have the following code from Derek Jones 20 min Blog tutorial.
I am trying to learn more by adding some extra functionality. As you can see I want to add a delete_post function. I am not sure how to do this however.
I have guessed that the syntax should be something like this:
but I am not sure what should go inside the brackets?
If anyone could help me that would be great.
Thanks guys.
D :-)
Hey Guys
I apologise for this question in advance as most of you guys probably find it insultingly obvious but I have the following code from Derek Jones 20 min Blog tutorial.
Code:
<?php
class Blog extends Controller {
function Blog()
{
parent::Controller();
$this->load->helper('url');
$this->load->helper('form');
}
function index()
{
$data['title'] = "My Blog Title";
$data['heading'] = "My Blog Heading";
$data['query'] = $this->db->get('entries');
$this->load->view('blog_view', $data);
}
function comments()
{
$data['title'] = "My Comment Title";
$data['heading'] = "My Comment Heading";
$this->db->where('entry_id', $this->uri->segment(3));
$data['query'] = $this->db->get('comments');
$this->load->view('comment_view', $data);
}
function comment_insert()
{
$this->db->insert('comments', $_POST);
redirect('blog/comments/'.$_POST['entry_id']);
}
function delete_post()
{
}
}
?>
I am trying to learn more by adding some extra functionality. As you can see I want to add a delete_post function. I am not sure how to do this however.
I have guessed that the syntax should be something like this:
Code:
function delete_post()
{
$this->db->where();
$this->db->delete();
redirect('blog');
}
but I am not sure what should go inside the brackets?
If anyone could help me that would be great.
Thanks guys.
D :-)