SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2006
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    display images from database

    hello all,

    I got small query to pull out image from database.
    It creates a table but second image is displayed below (verticaly).
    I want it to be displayed horizontaly, how can I achieve that?
    Thanks !!


    $result2 = mysql_query("SELECT * FROM tbl_usr_gal_pic where usr_email ='$email1' ");

    while($row2 = mysql_fetch_array($result2) )
    {

    echo "
    <TABLE BORDER=0 CELLPADDING=4>
    <TR>

    <td>"; echo '<img src =\'' . $row2[3] .'\' width="140" height="160" border="0" >'; echo "</td>

    <TD></TD> <TD> </TD>
    </TR>
    <TR>
    <td>Name</td>
    <TD> </TD> <TD> </TD>
    </TR>
    <TR>
    <td>$1,000.00</td>
    <TD> </TD> <TD> </TD>
    </TR>


    </TABLE>"; } ?>

  2. #2
    John 8:24 JREAM's Avatar
    Join Date
    Sep 2007
    Location
    Florida
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Change the $per_row to how many images you want in a row.
    PHP Code:

    $result2 
    mysql_query("SELECT * FROM tbl_usr_gal_pic where usr_email ='$email1' ");

    $i 0
    $per_row 5;

    echo 
    '<table>';
    echo 
    '<tr>';
    while(
    $row2 mysql_fetch_array($result2))
    {
        if (
    $i == $per_row)
        {
           echo 
    '</tr><tr>';
           
    $i 0;
        }
        echo 
    '<td>';
        echo 
    "<img src='$row2[3]'>";
        echo 
    '</td>';
        
    $i++;


    echo 
    '</tr>';
    echo 
    '</table>';
    ?> 


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
  •