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 3 of 3
  1. #1
    New Coder
    Join Date
    Apr 2011
    Posts
    16
    Thanks
    1
    Thanked 1 Time in 1 Post

    The dreeded putting div's next to each other......

    I'm tearing my hair out here (well would be if i had any) i want Div's next to each other, its basically displaying items that has been returned from a search, so there could be a maximum of 4 div's next to each other, or just one alone, this is the PHP, inside a while loop

    PHP Code:
    while ($lookup[$lc] != "") {
    $qry "SELECT * FROM Stock WHERE LOOKUP = '$lookup[$lc]'";
    $result mysql_query($qry);
    $row mysql_fetch_array($result);            

    $stocktype $row['STOCKTYPE'];
    $img $row['IMAGE'];

    if (
    $img == "") {
    $img "Images/nia.jpg";
    } else {
    $img "Images/" $img;
    }
                    
    list(
    $width$height$type$attr) = getimagesize($img);
    if (
    $width $height) {
    $no $width 100;
    $h $height $no;
    $w 100;
    } else {
    $no $height 100;
    $w $width $no;
    $h 100;
    }
                    
    echo 
    "<div class\"wrapper\">";                
    echo 
    "<img src= $img width=$w height=$h/>";
    echo 
    "</div>";
    $lc++;

    and the CSS

    Code:
    .wrapper {
    position: relative; 
    float: left; 
    padding:3px;
    width: 150px;
    }

  • #2
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    Thanked 354 Times in 353 Posts
    Code:
    echo "<div class=\"wrapper\">";
    "I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
    Validate your HTML and CSS

  • Users who have thanked AndrewGSW for this post:

    craig101 (05-11-2011)

  • #3
    New Coder
    Join Date
    Apr 2011
    Posts
    16
    Thanks
    1
    Thanked 1 Time in 1 Post
    Wow now i feel like a idiot, i guess in future don't do a all-nighter when coding, in the entire 8 hours i never noticed that was missing *facepalm* thanks


  •  

    Posting Permissions

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