Ok, so I have just began to start building sites using PHP, and I get this error:
Parse error: parse error, unexpected ')' in /home/imperia/public_html/
page.php on line 21
here is my code: as far as I know, there is nothing i have caught. Thanks for the help.
<html>
<head>
<title>Imperial Products Co.</title>
</head>
<body >
<?PHP
//check url for page if any
if (!$_GET[page]) {
header("Location: page.php");
exit;
}
//connects to database "Site"
function connectDB(){
$conn = mysql_connect("localhost",
"USERNAME", "PASSWORDHERE") or die(mysql_error());
mysql_select_db("imperia_s
ite",$conn
) or die(mysql_error());
}
// check if page exist
connectDB;
$check_page = "select header from mainpage where id = $_GET[page]";
$check_page_res = mysql_query($check_page, $conn) or die(mysql_error));
if (mysql_num_rows($check_pag
e_res) < 1) {
// Page does not exist
$display_block = "<P><em>This page does not exist. Please <a href=\"mailto:webmaster@im
perialprod
uctsco.com
?Subject=P
age does not exist\">report</a> this error.";
} else {
// Get the heading
$page_header = stripslashes(mysql_result(
$check_pag
e_res,0, 'heading'));
// Get the page data
$get_content = "select content from mainpage where id = $_GET[page]";
$get_content_res = mysql_query($get_content,$
conn) or die(mysql_error());
//Display the string
$display_block = "<p><strong>$page_header</
strong</p>
<br>
"
while ($page_display = mysql_fetch_array($get_con
tent_res))
{
$page_text = nl2br(stripslashes($page_d
isplay_con
tent['page
_text']));
//add to display
$display_block .= "$page_text";
}
}
}
?>
<?PHP print $display_block; ?>
</body>
</html>
Start Free Trial