Hi,
assuming that you have a database
"htmlpages" and a table
"tblHtmlPages" having the pages in it.
The field containing the html pages is
"txtContent". The field contains the whole page (.....). The field with the content id is named "lngContentID".
Try this:
<?PHP
$host="localhost"; // server
$login="mylogin"; // database login
$pass="mypass"; // login password
$db="htmlpages"; // database
$tbl="tblHtmlPages"; // table
$id=120; // unique content id
// not found message
$err="\n<head>\n<title>no content</title>\n</head>\n<body>\nNo html page found\n</body>\n\n";
$dblink = mysql_connect($host,$login,$pass) or die("Error connecting to mysql server");
mysql_select_db($db,$dblink) or die("Error selecting database");
$strSQL = "SELECT txtContent FROM ".$db
." WHERE lngContentID=".$id;
$result = mysql_query($strSQL,$dblink) or die("Error executing a query");
if (list($content) = mysql_fetch_row($result)) {
echo $content;
} else {
echo $err;
}
mysql_close($dblink);
?>