Zenax
Active Member
- Messages
- 1,377
- Reaction score
- 4
- Points
- 38
I have this website that I am designing! I am using PHP to pull certain elements from a database, such as website title etc.
However since I have inserted the PHP there appears to be a massive white space at the top of my document. Please help me fix this.
Main Index Page:
Style Document:
Connection Code:
However since I have inserted the PHP there appears to be a massive white space at the top of my document. Please help me fix this.
Main Index Page:
PHP:
<?php include("conn.inc.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<link rel="stylesheet" href="style_v3.css" type="text/css" />
</head>
<body>
<div class="topbar">
<div class="topbar_text">
<?php
$result = mysql_query("SELECT title FROM header"); // Queries the database for the header table
while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) // Chooses the correct row
print $row{'title'}; // Prints the header row
?>
<div class="small">
</div>
</div>
</div>
</body>
</html>
Style Document:
Code:
/* CSS Document */
body
{
font-family: Arial;
font-size: 11px;
color: #000;
padding: 0px;
margin: 0px;
}
.topbar
{
background-color: #003366;
border-bottom: 1px solid #000;
font-family: Arial;
width: 100%;
height: 100px;
}
.topbar_text
{
margin-left: 30px;
margin-top: 30px;
color: #FFF;
font-size: 24px;
}
.topbar_text .small
{
font-size: 10px;
}
Connection Code:
PHP:
<?php
$username = "root"; // Username Variable
$password = "PASSWORD REMOVED"; // Password Variable
$hostname = "localhost"; // The Host Name Variable
$dbh = mysql_connect($hostname, $username, $password) // The Server Connection string
or die("Unable to connect to MySQL!"); // Error to display if anything goes wrong
$selected = mysql_select_db("site",$dbh) // Connects to the database
or die("Could not select db site!"); // Error to display if anything goes wrong
?>
Last edited by a moderator: