Here's the code if it helps:
PHP Code:
<?php
// check to see if $id contains a value
if (!$id)
{
$id="2";
}
else
{
// connect to the main content database
$maincnx = @mysql_connect("localhost","root");
if (!$maincnx)
{
echo("<p>There was an error in connecting to the database: " . mysql_error() . "<br />\n" .
"A message has been sent to the webmaster. Please try again later.</p>");
exit();
}
// select the appropriate database
$mainselect = @mysql_select_db("main",$maincnx);
if (!$mainselect)
{
echo("<p>There was an error in selecting the database: " . mysql_error() . "<br />\n" .
"A message has been sent to the webmaster. Please try again later.</p>");
exit();
}
// extract the content and title from the database
$content = @mysql_query("select id, content, title, date from maincontent where id='$id'");
if (!$content)
{
echo("<p>There was an error in displaying the content for this page: " . mysql_error() . "<br />\n" .
"A message has been sent to the webmaster. Please try again later.</p>");
exit();
}
$results = mysql_fetch_array($content);
$contentid = $results["id"];
$contenttitle = $results["title"];
$contenttext = $results["content"];
$contentdate = $results["date"];
// assign the values to a temporary array, reassign to variables, and display on the page
// site template
include("header.php");
include("toppage.php");
echo("$contenttext");
include("footer.php");
}
?>
Bookmarks