-2

I have a problem with 404 error in CodeIgniter.I have in controller:

public function show($id = 0)
{
    $review = $this->site_reviews->get_review($id);


    if ($review)
    {
              .....
    }
    else
    {
        show_404();
    }

Now if I add to the end of link for example : /?id=13865 or /?id=42788?id=42788 all goes well...How to show_404()..Exist a solution?

Sparky
  • 98,165
  • 25
  • 199
  • 285
  • Your question is not clear - you are saying all goes well but you want to show a 404? – Dan Jun 10 '14 at 15:21

1 Answers1

0

This case when your id is in codigniter format:

$id=$this->uri->segment(3)//url:www.example.com/13865

This case when you use core php concepts is get:

$id=$_GET['id']//url:www.example.com?id=13865

public function show($id = 0)
{
    $review = $this->site_reviews->get_review($id);


    if ($review)
    {
              .....
    }
    else
    {
        show_404();
    }
saurabh kamble
  • 1,510
  • 2
  • 25
  • 42