title: Codeigniter & PHP - forcing a 404?
body: <p>In codeigniter, as you know, a page of the form: <code>/class/function/ID</code>, where class is the controller name, function is the method within the controller, and ID is the parameter to pass to that method.</p>
  
  <p>The typical usage would be (for a book site for example) to pass the book id to the function which would then query the database for appropriate book.  My problem is this: I was messing around and randomly (in the url string) typed in an ID that is not present in the database (with normal point and click browsing this would never happen) and I get database errors due to the residual queries I attempt to perform using a non-existent ID.</p>
  
  <p>I have written code to check if there are any rows returned before attempting to use the ID, but if the ID is non-existent I would like the user to get a 404 error page rather than a blank page or something (since this seems like proper functionality).  This would need to be a true 404 page (not simply loading a view that looks like a 404 page) so as not to screw with search engines.  Okay - so my question is this: within normal program logic flow (as described above) how can I force a 404 error using codeigniter?  Thanks.</p>
  
  <p><strong>Update</strong>: code igniter has a <code>show_404('page')</code> function but I don't think this will generate a true HTTP 404 error...</p>