Website help

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:
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:

lambada

New Member
Messages
2,444
Reaction score
0
Points
0
I removed your db password
And does it print the title from the db?

Also try adding underneath the mysql query:
PHP:
echo mysql_error($dbh);
That will echo any error in your query which may be responsible for the whitespace.

Also in the query line, I believe that you need to pass the $dbh or the $selected to it before you pass the query to it. Though I may be mistaken in this.
 
Last edited:

Zenax

Active Member
Messages
1,377
Reaction score
4
Points
38
Thanks lambada. Yes it does print the title from the database. im not entirely bothered about the password thingy as it can be easily changed, and it is sat on my home comp so its ok, but thanks anyway!

No errors are emitted from that code.

take a look here:
http://freezebox.x10hosting/new/
 

lambada

New Member
Messages
2,444
Reaction score
0
Points
0
Ok in the css try
Code:
.topbar
{
background-color: #003366;
border-bottom: 1px solid #000;
padding-top: 0px;
font-family: Arial;
width: 100%;
height: 100px;

}
 

Zenax

Active Member
Messages
1,377
Reaction score
4
Points
38
no difference made :(

this is starting to annoy me, i can't think of anything that would cause this, unless its the PHP which is my only thought on this!

Regards,
Zenax

PLEASE NOTE THAT PROBLEM IS ONLY IN FF!
 
Last edited:

lambada

New Member
Messages
2,444
Reaction score
0
Points
0
It's the topbar-text part of your CSS
If you replace the margins with
Code:
margin: 0px;
Then it works in FF.
My guess is that it's the Box MOdel inconsistency in IE.
Tell me if that keeps it working in IE or not.
I'll try and find a better solution if not.
 
Last edited:

Zenax

Active Member
Messages
1,377
Reaction score
4
Points
38
thanks, but now that stops the text from being 30px in top and left
 

lambada

New Member
Messages
2,444
Reaction score
0
Points
0
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
{
padding-top: 30px;
padding-left: 30px;
color: #FFF;
font-size: 24px;
}

.topbar_text .small
{
font-size: 10px;
}
That should solve it hopefully. I used the padding element.
 

Zenax

Active Member
Messages
1,377
Reaction score
4
Points
38
It works! Thanks Lambada, you have been a great help!
 
Top