papaface Posted April 22, 2007 Share Posted April 22, 2007 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 More sharing options...
papaface Posted April 22, 2007 Author Share Posted April 22, 2007 Anyone? This is driving me insane lol Link to comment https://forums.phpfreaks.com/topic/48128-solved-not-displaying-correctly/#findComment-235216 Share on other sites More sharing options...
papaface Posted April 22, 2007 Author Share Posted April 22, 2007 I have worked it out. Link to comment https://forums.phpfreaks.com/topic/48128-solved-not-displaying-correctly/#findComment-235244 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.