简体   繁体   中英

PHP/Mysql Query Output Table

I need a hand here with some PHP/MySql please.

This is what my database looks like: http://cl.ly/2v022Y1w352r1x091Y3C

And this is how I need to output it: http://cl.ly/0V2X120M3H1R1G3z0B2Y (in the case that product = 'canvas' and type = 'single_pane')

I'm struggling to find a way to output the database into that table. I'm guessing I would need to group the rows by the same product, type, width, and height. I'm really not sure how to do this, I looked into the "GROUP" MySql function, but no luck.

Any help would be greatly appreciated!

Thanks, Alain

I think you need to do a crosstab query, and this is your man for MySQl.

http://rpbouman.blogspot.com/2005/10/creating-crosstabs-in-mysql.html

His example is complicated but it might help. And this one is a little less daring: http://www.leghumped.com/blog/2008/11/16/crosstab-queries/

Chuck

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM