Joomla 2.5 Framework

65 views
asked Feb 12, 2013 in Database by Donald (2,780 points)
hi all
I am using Joomla 2.5 Framework, and I have a simple small table :
String item_id
Int id
Text name

I want to load all the item_id values to an  array using JTable. Can anyone please tell me how to do this?
Thank you in advanced.

1 Answer

0 like 0 dislike
answered Feb 12, 2013 by FixHost (12,380 points)
You can inherit the model class from JModelList like this:
class modelModelcomponent extends JModelList
{
        protected function getListQuery()
        {
                      
            $db = JFactory::getDBO();
            $query = $db->getQuery(true);

            
            $query->select('item_id');

            
            $query->from(tablename);

            return $query;
        }
}
...