0

I am using a While loop to dispay data stored in a mysql database I would like all the data to be displayed on a single line instead of being displying below the prevoius.

while($row = mysql_fetch_assoc($popular)){
echo"<figure>
<div align=\"center\">
<a href=\"\"><img src=\"images/" . $row['product_img'] . ".png\" alt=\"" . $row['alt_desc'] . "\"></a>
<figcaption><p>" . $row['product_name'] . "<br>
<b>£" . $row['product_price'] . "</b>
</p></div></figure>";  
}

I think it is something to do with the figure element as when I only looped this line:

<a href=\"\"><img src=\"images/" . $row['product_img'] . ".png\" alt=\"" . $row['alt_desc'] . "\"></a>

The images would be disped next to each other not not listed down the page.
Does anyone how any ideas how I could solve this problem.

4
Contributors
4
Replies
15
Views
4 Years
Discussion Span
Last Post by |-|x
0

The images would be disped next to each other not not listed down the page.

You mean a single line not a inline. A inline you need CSS to do that another words CSS needs to be involve with the code.

It should look like this

<div class="center" style="display:inline-block;">
<a href=\"\"><img src=\"images/" . $row['product_img'] . ".png\" alt=\"" . $row['alt_desc'] . "\"></a>
</div>

The code I provided is a inline-block.

It's a single line or inline which I'm not sure what you are trying to do.

If that's not what you want then you really need to explain it very clearly.

Edited by LastMitch: grammer

0

Style sheet provide us a lots of attributes to do lots of things. Where we not get the need any java script. CSS is really helpful for us.

0

You have no closing tag for the figcaption which may cause layout problems

<figure>
<div align=\"center\">
<a href=\"\"><img src=\"images/" . $row['product_img'] . ".png\" alt=\"" . $row['alt_desc'] . "\"></a>
<figcaption><p>" . $row['product_name'] . "<br>
<b>£" . $row['product_price'] . "</b>
</p></div></figure>

Edited by |-|x

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.