Jump to content


Formatting each row of results and grouping by category?

  • Please log in to reply
No replies to this topic

#1 sciulli

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 19 April 2006 - 10:37 PM

I've spent 6+ hours and have only managed to get errors, all results on one line, or all the results in the same format. I could post some of my sample code, but it's useless. If someone could point me in the right direction, or even provide a relevant tutorial link for this type of process it would be greatly appreciated.

I am trying to query the database to list all orders while grouping them by category and displaying different rows in different formats. Here's a sample of my database:

Table product_categories
product_cat_desc product_cat_number
mens 1
womens 2

Table products
product_id product_desc product_cat
34 long sleeve 1
35 short sleeve 2

Table orders
order_date order_id
02-11-2005 3
02-10-2005 4
02-11-2005 5

Table orders_products
order_product_id order_id
34 3
35 4
34 5

Table orders_products_options
order_option_title order_product_value order_id
size large 3
color blue 3
size small 4
color pink 4
size medium 5
color gray 5

What I would like to do (if it's even possible) is:
group each order by product_categories
display the category heading as underlined
if the order_option_title is "size" display the order_product_value in bold
if the order_option_title is "color" display the order_product_value in italics

Mens (underlined)

Large (in bold)
blue (in italic)

Medium (in bold)
gray (in italics)

Womens (underlined)

Small (in bold)
pink (in italics)

Thanks in advance to anyone who can guide me.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users