Hello all i am new but got so many helps from here. Thanks to all the people who helped. Now i am facing a problem in magento e-commerce for making a loop query of top 10 point holders. Well i have made a separate database which contain the points .
my database is table : magentodatabase_points Now here is total 3 colums - 1. ID 2. User_id 3. points
well now, here i would like to make a loop of top 10 members contain the highest points i have tried but failed so can anybody help me on that.
$resource = Mage::getSingleton('core/resource');
$readConnection = $resource->getConnection('core_read');
$table = $resource->getTableName('database_points');
$query = 'SELECT user_id FROM ' . $table . ' ORDER BY points DESC LIMIT 10';
$results = $readConnection->fetchAll($query);
well but after that i have tried with php for loop but that is not supporting for magento. So can anybody know what will be the loop code for magento.
Well, one more help would be greatful for me how do i get magento customer names from the using the top results of user_id because i will get only the results not the names.
Anyways that is not that important because i hope i will solve it by my own.
So, please if anyone can help me on the loop query of top 10 point holders.
Thanks in advace and sorry for my bad english
fetchAll()returns an array, so that has nothing to do with Magento, but rather with PHP. How is it not supported? Are you getting an exception? if so, what is it?