SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Threaded View

  1. #1
    SitePoint Wizard co.ador's Avatar
    Join Date
    Apr 2009
    Posts
    1,054
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need to set up a (if) condition within a looped <table> to break left floating.

    PHP Code:
     $query "SELECT shoe.shoename, shoe.price, shoe.moreinfo 
    FROM shoe
    INNER 
    JOIN shoe_kind 
    ON shoe.kind_id=shoe_kind.kind_id"

    $result mysql_query($query$connection);
    while (
    $row mysql_fetch_array($result)) {
    echo 
    "<table style=\"float:left\">
    <td width=\"150\" style=\"text-align:center;\">" 
    $row['shoename'] . "</td>
    <tr>
    <td height=\"100\" width=\"100\"   style=\"position:relative;\">
    <img src=\"../images/shoesname.jpg\" alt=\"sd\" width=\"97\" height=\"80\"  border=\"1\" style=\"border-color:#FF6600;\" />
    </td></tr>
    <tr>
    <td width=\"5\" height=\"21\" ></td><td>" 
    $row['price'] . "</td>
    </tr>
    <td>" 
    $row['moreinfo'] . "</td>
    </table>"
    ;

    The code above contains a while loop that floats all the elements within that table to the left. Now I want the floated elements to repeat to the left only under the condition that when it repeats four times to the left to stop and go down and continue below is an ilustration of what I been trying to accomplish example:

    Instead of repeating to the left all the time like this:

    - - - - - - - - - - - -

    I want the loop to stop when it repeat four times and then go down again and repeat four more and so on. example:

    - - - -
    - - - -
    - - - -
    - - - -

    Like that.

    Any body can help me?

    I tried the relative position but then it keep repeating to the left endlessly, tried the absolute position but it just show the last repeated element of the loop.

    it there any other option which you might come up with guys?
    Last edited by co.ador; May 9, 2009 at 12:33.


Bookmarks

Posting Permissions

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