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