I've managed to get custom models to load before with the following code:
$model = Mage::getModel("banner/banner")
->getCollection()
->load();
But I need to now sort by an order value as well as limit the results to 6. So I wrote the following:
$home_blocks = Mage::getModel("homeblocks/homeblocks")
->getCollection()
->setOrder('order', 'ASC');
->setPageSize(6)
->setCurPage(1);
->load();
This however is causing werrors, specifically the following Magento error
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order ASC' at line 1
The column is defiantly called order. Adding data from the back end of magento works fine. it's just when trying to read out I'm having issues.
For reference I'm currently sticking the code directly into a custom layout file locate din the pages folder with the other default templates of my theme.