I'm back once again, trying to create a "custom" blog system. Or a CMS, as people call it. This is my current code:
<?php
//include stuff here
$pid = $_GET['pageid'];
$data = mysql_query("SELECT * FROM entries WHERE id='$pid'") or die("MySQL died.");
mysql_real_escape_string($pid);
while($info = mysql_fetch_array( $data ))
{
if (!empty($info)) {
echo $info['data'];
}
else {
echo 'This page no existo.';
}
}
?>
What's happening is that it's not showing "This page no existo." as the '404' text. Lets say someone is trying to go to my site directly typing it but make a mistake: localhost/blog/?pageid=10 It doesn't show the 404 text!
I have a row named "data" in MySQL. It consists of the-- um... data of the blog post. I also have a row called ID which is an auto increment ID system. The "real", working page ID is 1.
Thanks, RBLXDev.
EDIT: Vardump of $info: The vardump:
array (size=10)
0 => string '1' (length=1)
'id' => string '1' (length=1)
1 => string 'Testing potatoCMS... and the title.' (length=35)
'title' => string 'Testing potatoCMS... and the title.' (length=35)
2 => string 'This is a test.
This is a new line.
This is a cookie.
You are getting fat.
FAT.<br />lol' (length=88)
'data' => string 'This is a test.
This is a new line.
This is a cookie.
You are getting fat.
FAT.<br />lol' (length=88)
3 => string '2013-02-02' (length=10)
'date' => string '2013-02-02' (length=10)
4 => string 'Unspecified' (length=11)
'author' => string 'Unspecified' (length=11)
Yeah, um... I have weird placeholders.