Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: New to php

  1. #1
    New to the CF scene
    Join Date
    Nov 2012
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    New to php

    I've been self learning php and i know the basic concepts and i decided to put it to practice by creating a php blog. i'm having trouble styling it with css.Any suggestions.


    HTML

    <!DOCTYPE html>
    <html>
    <head>
    <title>Kagori mainpage</title>
    <link rel="stylesheet" type="text/css" href="kagori.css">
    </head>
    <body>
    <div class="header" >
    <ul>
    <li><a href="kagori.php">Home</a></li>
    <li><a href="about.php">About</a></li>
    <li><a href="contact.php">Contact us</a></li>
    </ul>
    </div>
    <div class="banner"></div>
    <div class="content" >
    My Blog<hr/>
    <?php
    $sql=mysql_query("SELECT*FROM kgtable ORDER BY id DESC");
    while($row=mysql_fetch_array($sql)){
    $title=$row['title'];
    $content=$row['content'];
    $category=$row['category'];
    ?>
    <table>
    <tr><td><?php echo $title?> </td><td><?php echo $category ?> </td></tr>
    <tr><td colspan='2'> <?php echo $content?> </td></tr>
    </table>
    <?php
    }
    ?>
    </div>
    <div class="footer"></div>

    </body>
    <html>

    CSS
    body {
    background: #bfc4c0;
    }
    .header{
    display: block;
    position: absolute;
    top: 0px;
    width: 100%;
    left: 0px;
    height: 35px;
    background: #313632;
    }
    .header ul {
    margin: 0;
    padding: 0;
    }
    .header ul li {
    display: inline;
    list-style-type: none;
    }
    .header li a {
    color: #22eb57;
    display: block;
    float: left;
    padding: 5px 10px;
    text-decoration: none;
    }
    .header li a:hover {
    text-decoration: underline;
    }
    .banner{
    display: block;
    position: absolute;
    width: 1000px;
    height: 300px;
    background: url("http://i1273.photobucket.com/albums/y404/Edward_Gichuru/kagoribann_zps6e150f8d.jpg") center ;
    top:45px;
    left: 199px;
    }
    .content{
    display: block;
    position: absolute;
    top: 360px;
    width: 100%;
    height: 300px;
    left: 0px;
    background: transparent;
    }
    .footer{
    display: block;
    position: absolute;
    top: 700px;
    width: 100%;
    left: 0px;
    height: 50px;
    background: #313632;
    }

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,287
    Thanks
    23
    Thanked 611 Times in 610 Posts
    edgich, after posting here 6 times you should be aware of the hash mark (#) located above the Message box. Use that to generate the [code] tags and put your code inside of them please.

    Also this is a css question not a php question and is in the wrong place.

    There does not seem to be a question. Please ask or tell us what is not styling for you.
    BTW, you don't style php. PHP generates html and you style that. If you want to know what I think you want to know add TABLE or TD or TR to the css.
    Your code looks good. You don't show your connect to the DB, but I imagine you have it somewhere, right?
    Last edited by sunfighter; 01-27-2013 at 04:21 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •