April 6, 2012

mysql how to select the top ten values and store them into vars?

Question by user1200640

How do I select the top ten values (largest) from a column and store them in php variables ?

I tried this but it is not working :

SELECT counter FROM hitscountervote 
WHERE counter = counter 
ORDER BY counter DESC LIMIT 10

Answer by Starx

Not sure of the exact problem but try this. I added quotes and Limits

SELECT counter FROM hitscountervote 
WHERE counter = 'counter' 
ORDER BY counter DESC LIMIT 0,10

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!