printing out the data after php while loop

Dear Experts,
I select data from my database which has my stored images paths.
I select them then print them on the screen. However they are not adjacent ( side by side ). Since I use table, every one of them in a  different row.
How can I put them side by side? I tried to do it with <div> but I couldn't.

$sql8 = "SELECT xxxxx FROM resimler where uid='$uid' and ilanid='$ilanid' order by id";
$result8 = $conn->query($sql8);

    while($row8 = $result8->fetch_assoc()) {
	$id= $row8["id"];
	$ilantarihi= $row8["ilantarihi"];
	$resim= $row8["resim"];
	//echo "<div style=width:auto; float:left>
//<img class=kucult src=$resim /> </div>";
		echo "<table><tr><td>
<img class=kucult src=$resim /></td></tr></table>";

Open in new window

Who is Participating?
Mukesh YadavConnect With a Mentor Full Stack DeveloperCommented:
Try this ;)

The div element code snippet is correct in this wrap html element attribute values in double quotes(") like:

<div style="width:auto; float:left">
    <img class="kucult" src="" />

Open in new window

You can remove double quotes for values have single character or work for multiple works or special characters double quotes are required in this case for style and src double quotes are required you can omit for class.
BraveheartliMarketingAuthor Commented:
Dear Mukesh Yadav,
 It's not the case. I don't think it is something to do with double quotes or not.

I think my div or table structure is wrong.
BraveheartliMarketingAuthor Commented:
I did it like this:

I created the table out of the while loop, and I close the table again outside of the while loop.

I only used the <td> tag inside the while loop.
It solved my problem.
BraveheartliMarketingAuthor Commented:
Actually I need a replace function
I want to replace empty space with something
BraveheartliMarketingAuthor Commented:
Thanks for the reply
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.