Sign in to follow this  
Tombstone

Charting only the highest 10 values of a field?

Recommended Posts

Hi all,

 

 

 

Probably a stupid question, and may well just be me being dumb, but assuming I have a field (Pages) within my database, is there anyway to chart only the 10 records with the highest number of Pages?

 

 

 

I can successfully chart everyone of course, but its mayhem on a piechart with 400 records showing :)

Share this post


Link to post
Share on other sites

Hello Tombstone,

Welcome to the forum :)

Could you please try to pass an SQL Query which will return the top 10 rows of the table (on the basis of your chosen field) to the FusionCharts class?

Share this post


Link to post
Share on other sites
Dhruva (4/1/2009)
Hello Tombstone,

 

 

 

Welcome to the forum :)

 

 

 

Could you please try to pass an SQL Query which will return the top 10 rows of the table (on the basis of your chosen field) to the FusionCharts class?

 

 

 

Thanks,

 

 

 

I think I am way off the mark on this, been staring at too much PHP today and its all blending into each other :)

 

 

 

Just operating off the dbexample.php at the moment, and tried this..

 

 

 

$strQuery = "select * from (SELECT Pages FROM April ORDER BY Pages+0 DESC) as TotOutput where ROWNUM < 11 and User=" . $ors['User'];

 

 

 

But that seems to be totally wrong, which isnt surprising for me :)

Share this post


Link to post
Share on other sites

Hello again!

Could you modify your query thus, and try again?

$strQuery = "select * from (SELECT Pages FROM April ORDER BY Pages+0 DESC LIMIT 10) as TotOutput where User=" . $ors['User'];

Hope this helps! :)

Share this post


Link to post
Share on other sites

Thanks :)

 

 

 

Luckily I managed to get it sorted this morning, amazing what a night of not staring at the php can do :)

 

 

 

Corrected the error I was making and its now working beautifully !

Share this post


Link to post
Share on other sites

Hi!

You're welcome! :)

Understandably so. :hehe: Looking constantly at code can make one woozy. We're people, after all, not compilers. :)

Always happy to help, though! :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this