Jump to content

[SOLVED] Not displaying correctly


papaface

Recommended Posts

Hello,

I am having a problem with extracting records from the db and displaying them correctly.

Currently in the database I have 20 or so records. The database structure is like this:

image_id| image_path| title| description| status| category

I have data which I want to get from the database and put into the relevant boxes on the page depending on what category they are in.

They need to go in this code:

				
<div class="middle_box_toplong">Title 1</div>
<div class="center_boxlong">
<div align="left">
<img src="<?php echo $path; ?>" width="50" height="50" />
</div>
</div>

I want all the images from category 1 to be displayed with a box titled "1" like this:

				
<div class="middle_box_toplong">1</div>
<div class="center_boxlong">
<div align="left">
<img src="<?php echo $path; ?>" width="50" height="50" />
<img src="<?php echo $path; ?>" width="50" height="50" />
<img src="<?php echo $path; ?>" width="50" height="50" />
<img src="<?php echo $path; ?>" width="50" height="50" />
<img src="<?php echo $path; ?>" width="50" height="50" />
</div>
</div>

This will obviously be in a while loop. But there are more than one category to get from the database.

The problem I am having at the moment is that it is making a new box for every single image coming from the database, when i just want it to add the image into the relevant box.

 

Sorry for my poor description, it is difficult to explain.

Let me know if you do not understand.

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/48128-solved-not-displaying-correctly/
Share on other sites

Archived

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

×
×
  • Create New...

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.