I am trying to create an error page but I want to specify it on a certain dictionary.
the problem is that it is a php file.
for example if I have a page with a title called page1 only and do not have anything else, I want to display an error for every other page that does not exist like page2.
http://example.com/showpage.php?title=page1
http://example.com/showpage.php?title=page2
I do not want to use htaccess because there is other files in the same dictionary that I want to display another error message.
I am trying to create an error page but I want to specify it
Share
Do you query against a database or do you include real files like page1.php for example?
EDIT:
If you are using MySQL, then you want to use mysql_num_rows() against your query and if that returns true, do all the echoing, but if it returns false, then include_once(‘error-for-non-existing-title.php’); Optionally if no $title variable is set, you could throw a 404 header. You can rewrite your 404 documents in .htaccess if you want to
I think for an online-reader, you should have more than one variable ($_GET[‘title’]) AND $_GET[‘page’]. Use $title to differentiate between different titles and $page to navigate through it’s pages.
I guess you don’t know how to use PDO yet, so..