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
  1. #1
    New to the CF scene
    Join Date
    Dec 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Div tag Auto-Position

    Hello,

    {This is my first post}

    I have a website I'm designing and I need to auto-make divs, Below is a better description of the website and why this would be helpful.

    Website Content:
    Based On Hobby: Miniature Painting (Little thumb size action-figures)
    It allows users to upload an image and add a short description, the website stamps the time, date, and description into a MySQL Database. When this is displayed, it shows the image, then directly below the time and date of upload with the short description beneath. For those who don't know much about miniature painting, you can have thousands of these little guys, but i have decided a cap of 300 - 400 miniatures. I would like 4 miniatures per row, and to auto-position a new div on the desired page when a user uploads a new miniature based on where the last one was positioned. For example, if i have 5 miniatures already submitted, with 4 per row, the next one would be on row 2 at spot 2.

    Is there anyway i can achieve this?
    Thank You for any support.

    ~Turt2

  • #2
    Regular Coder seco's Avatar
    Join Date
    Nov 2008
    Location
    Oregon
    Posts
    687
    Thanks
    6
    Thanked 79 Times in 77 Posts
    mysql, php, while loop.

    wrapper div width

    thumbnail div width should fit 4 in wrapper with float left.

    example:
    PHP Code:
    <?php
    // Make a MySQL Connection
    mysql_connect("localhost""admin""1admin") or die(mysql_error());
    mysql_select_db("test") or die(mysql_error());

    // Retrieve all the data from the "example" table
    $result mysql_query("SELECT * FROM example")
    or die(
    mysql_error()); 

    $result mysql_query($query) or die(mysql_error());
    ?>
    <!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=utf-8" />
    <title>Untitled Document</title>
    </head>

    <body>
    <div style="width:600px; height:auto;">
    <?php while($row mysql_fetch_array($result)){ ?>
      <div style="width:134px; height:100px; float:left; margin:2px;">
       <img src="<?php echo $row['photo'[; ?>" border="0" width="134" height="100" />
      </div>
    <?php ?>
    <div style="clear:both;"></div>
    </div>
    </body>
    </html>
    Last edited by seco; 12-21-2009 at 06:53 AM.


  •  

    Tags for this Thread

    Posting Permissions

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