Jump to content

Archived

This topic is now archived and is closed to further replies.

MoFish

Displaying Images

Recommended Posts

hey.

im currently using the following code to display images in my gallery. It displays 3 per row in firefox, however when i go to explorer, it displays one image per row, which is not the effect im after. means endless scrolling. :)

is there a solution to make this work in explorer too?


[code]
while ($myrowimage = mysql_fetch_array($imageresult) ) {     
    
    $image = $myrowimage["image"];
    $name = $myrowimage["author"];
                
    echo '<div class="gallery">';                      
        echo "<a class='pic' href='gallery/$image' target='_blank'> <img src='gallery/tn_$image' /><br/>Uploaded By <b>$name</b> </a>";
        echo '</div>';

}
[/code]

[code]
.pic    {     height:150px;
            width:180px;
        float:left;
        padding:5px;
        margin:5px;
        text-align:center;
        font-family: Verdana, Arial, Helvetica, sans-serif;
        font-size: x-small;
}
[/code]

Share this post


Link to post
Share on other sites
This is what i use... change the ($x%3) to the number of results you want per row.

[code]
<?php
// YOUR MYSQL QUERY GOES HERE
$numberall = mysql_numrows($result);

if ($numberall==0) {
    echo "No Results Found !";
}
else if ($numberall>0) {
$x=0;
?>

<table class="content" align="center">
<?
while ($x<$numberall)
      {
           if (($x%3)==0) { $row="</tr><tr><td class=report>"; } else { $row="<td>"; }
            $variable=mysql_result($resultall,$x,"my_table_row");

?>

<? echo $row ?>

<td class="report">

<?=$variable?>

</td>

<?
        $x++;
    } // end while
} // end if numberall > 0
?>
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.