0

Hello Guys, I just Worried here, This code it show to display multiple Images from database and The Name of Image, And I want to Display it Vertically then the Name of Images it should be the under of Images. I dont know how to do this thanks Guys. hers my code.

<?php

                        $query = "SELECT * FROM user where imgcheck = 'check' ORDER BY RAND() limit 10";
                        $result = mysql_query($query);



                                        while ($row = mysql_fetch_object($result)) 
                                            {
                                            echo "<table>";
                                            echo "<tr>";
                                            echo "<td colspan='2'>";
                                                echo '<img src="view_profile.php?id=' . $row->id . '" width="100" height="100">';
                                            echo "</td>";
                                            echo "</tr>";
                                            echo "<tr>";
                                            echo "<td>";
                                                echo "<h6>$row->FullName</h6>";
                                            echo "</td>";
                                            echo "</tr>";
                                            }




?>

Edited by jovstudios

5
Contributors
4
Replies
28
Views
3 Years
Discussion Span
Last Post by Assembly Guy
0

Perhaps don't use a table as the table won't wrap on smaller screens. Floated and inline-block containers will wrap/drop.
Anyway, I'm pretty sure this isn't PHP - you're probably looking at CSS - possibly JS too if you need to control vertical heights.

Edited by diafol

0

you can try this while making your own CSS for thumbnail class.

<?php
$col = 4 ; // number of items per row.
$count = 0;
$num_rows = mysql_num_rows($result);
while ($row = mysql_fetch_object($result))
{
if ($count == 0 || ($count % $col == 0 && $count < $num_rows)) { ?>
    <div class="row">
<? } ?>
        <div class="thumbnail">
            <img src="view_profile.php?id=' . $row->id . '" width="100" height="100">
                <h6>$row->FullName</h6>
        </div>
<?
$count++;
if ($count % $col == 0) {
    ?>
    </div>
    <hr>
<? } } ?>
0

you're probably looking at CSS - possibly JS too if you need to control vertical heights.

As diafol highlighted, this isn't a PHP question. However, you've already posted here and gotten some answers so I'll continue.

Could you elaborate on your problem. Do you mean vertically centre items or display images down the page or what?

Edited by Assembly Guy

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.