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>";
                                            }




?>

Recommended Answers

All 4 Replies

Member Avatar for diafol

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.

Hello, you should set table size on general tag and set style="Float:none"

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>
<? } } ?>

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.