Jump to content

Archived

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

Darkness Soul

How to sum rows?

Recommended Posts

Yo,

I need a little help, maybe its simple, but i don't know how to do it!

At the index page, I have a table, with cars to be sold! like..

[table][tr][td]id ---[/td][td]36x ---[/td][td]60x ---[/td][/tr][tr][td]1 [/td][td]15[/td][td][/td][/tr][tr][td]1 [/td][td][/td][td]8[/td][/tr][tr][td]2 [/td][td]10[/td][td][/td][/tr][tr][td]3 [/td][td]25[/td][td][/td][/tr][tr][td]3 [/td][td][/td][td]12[/td][/tr][/table]

What I'm suppose to do, to sum these rows, and return something like it?:

[table][tr][td]id ---[/td][td]36x ---[/td][td]60x ---[/td][/tr][tr][td]1 [/td][td]15[/td][td]8[/td][/tr][tr][td]2 [/td][td]10[/td][td][/td][/tr][tr][td]3 [/td][td]25[/td][td]12[/td][/tr][/table]

The data come from 3 tables, using joins.. someone know how i do to simplify this table?

Thank you!!

D.Soul

Share this post


Link to post
Share on other sites
Oh... you want to collapse/compress this layout... it sounds like you'll have to do it yourself in PHP, if you're getting back one row-one record.  It may be possible do accomplish this with a very ugly looking query, but I don't really see the point.

Share this post


Link to post
Share on other sites
I think about use an aux table to record it with the PHP, and then, liten all compressed.. =)

Thank you anyway ^^

D.Soul

Share this post


Link to post
Share on other sites

×

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.