+ Reply to Thread
Results 1 to 9 of 9

Thread: Website help

  1. #1
    Zenax's Avatar
    Zenax is offline Lord Of The Keys Zenax is an unknown quantity at this point
    Join Date
    Jul 2006
    Location
    The Brilliant United Kingdom
    Posts
    1,339

    Website help

    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 Code:
    <?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 Code:
    <?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 lambada; 04-25-2007 at 12:06 PM. Reason: Removed Password. Wouldn't want people getting accessto your database ;)
    Regards,
    Zenax

  2. #2
    lambada's Avatar
    lambada is offline x10 Elder lambada is an unknown quantity at this point
    Join Date
    Mar 2006
    Location
    Caister, Gt Yarmouth, Norfolk, ENGLAND
    Posts
    1,222

    Re: Website help

    I removed your db password
    And does it print the title from the db?

    Also try adding underneath the mysql query:
    PHP Code:
    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 by lambada; 04-25-2007 at 12:11 PM.
    Lambada - the former Account Manager (before I resigned)




  3. #3
    Zenax's Avatar
    Zenax is offline Lord Of The Keys Zenax is an unknown quantity at this point
    Join Date
    Jul 2006
    Location
    The Brilliant United Kingdom
    Posts
    1,339

    Re: Website help

    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/
    Regards,
    Zenax

  4. #4
    lambada's Avatar
    lambada is offline x10 Elder lambada is an unknown quantity at this point
    Join Date
    Mar 2006
    Location
    Caister, Gt Yarmouth, Norfolk, ENGLAND
    Posts
    1,222

    Re: Website help

    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;
    
    }
    Lambada - the former Account Manager (before I resigned)




  5. #5
    Zenax's Avatar
    Zenax is offline Lord Of The Keys Zenax is an unknown quantity at this point
    Join Date
    Jul 2006
    Location
    The Brilliant United Kingdom
    Posts
    1,339

    Re: Website help

    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 by Zenax; 04-26-2007 at 03:59 PM.
    Regards,
    Zenax

  6. #6
    lambada's Avatar
    lambada is offline x10 Elder lambada is an unknown quantity at this point
    Join Date
    Mar 2006
    Location
    Caister, Gt Yarmouth, Norfolk, ENGLAND
    Posts
    1,222

    Re: Website help

    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 by lambada; 04-26-2007 at 04:51 PM.
    Lambada - the former Account Manager (before I resigned)




  7. #7
    Zenax's Avatar
    Zenax is offline Lord Of The Keys Zenax is an unknown quantity at this point
    Join Date
    Jul 2006
    Location
    The Brilliant United Kingdom
    Posts
    1,339

    Re: Website help

    thanks, but now that stops the text from being 30px in top and left
    Regards,
    Zenax

  8. #8
    lambada's Avatar
    lambada is offline x10 Elder lambada is an unknown quantity at this point
    Join Date
    Mar 2006
    Location
    Caister, Gt Yarmouth, Norfolk, ENGLAND
    Posts
    1,222

    Re: Website help

    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.
    Lambada - the former Account Manager (before I resigned)




  9. #9
    Zenax's Avatar
    Zenax is offline Lord Of The Keys Zenax is an unknown quantity at this point
    Join Date
    Jul 2006
    Location
    The Brilliant United Kingdom
    Posts
    1,339

    Re: Website help

    It works! Thanks Lambada, you have been a great help!
    Regards,
    Zenax

+ Reply to Thread

Similar Threads

  1. Which is the best free DNS ???
    By careerbridge in forum Scripts & 3rd Party Apps
    Replies: 37
    Last Post: 09-18-2009, 12:26 PM
  2. Replies: 18
    Last Post: 09-25-2006, 04:32 PM
  3. googkle.com
    By dsfreak in forum Off Topic
    Replies: 17
    Last Post: 07-12-2006, 05:09 PM
  4. Showcase Website Awards
    By Kay in forum Graphics & Webdesign
    Replies: 2
    Last Post: 10-15-2005, 03:28 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers