Jump to content

Limiting output from the database


gwh

Recommended Posts

Hi everyone,

 

I have a garments table in my database where each row represents one garment. These garments will be output to the browser in a slideshow application.

 

Each slide in the slideshow displays an image of the garment as well as information about it. Some of the images consist of two garments, ie. both a men's garment and a ladies garment in the one shot. With these dual images, both the men's and ladies information need to be output on the one slide. Since each of the rows in the database table represent one unique garment, be it men's or ladies, I was going to create two SQL queries - one each for both the male and female garment types. The result set would depend on whether a column in the garments table is set to either male or female.

 

One of the columns in the garments table is for a title so if a 'dual' men's/ladies image is used on a slide, this means that the title for each of these garments in the database table will be the same since they're being output together. An example title would be "men's and ladies co-ordinate shirts". So since both of these two rows that are being output to the one slide will have the same title, I need to find a way to make sure it's output just the once.

 

I'm assuming I'd need to add another column to the table with information on whether the image is dual or single but I'm not sure how I'd approach it with the php. I mean would I have to create a third SQL query that pulled down the titles separately based on this extra column?

 

Could someone maybe comment on this and maybe provide some sample code?

 

Really appreciate any advice.

Link to comment
https://forums.phpfreaks.com/topic/191757-limiting-output-from-the-database/
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.