title: Joomla 2.5 component geting data from database on admin
body: <p>I want to get data from database in admin section of my component.
  The strange thing is that the same code works on site part of my component but does not work on the admin part.</p>
  
  <p>models/statistic_adm.php</p>
  
  <pre><code>&lt;?php
  defined('_JEXEC') or die;
  
  jimport('joomla.application.component.model');
  jimport( 'joomla.database.database' );
  jimport( 'joomla.database.table' );
  
  class sblogModelstatistic_adm extends JModel
  {
      public function getCode(){
          $db =&amp; JFactory::getDBO();
          $query = 'SELECT `code` FROM `#__sblog_ustawienia`';
          $db-&gt;setQuery($query);
          return $db-&gt;loadRowList();
      }
  }
  </code></pre>
  
  <p>views/statistic_adm/tmpl/default.php</p>
  
  <pre><code>&lt;?php
  // No direct access to this file
  defined( '_JEXEC' ) or die('Restricted Access');
  $document = JFactory::getDocument();
  jimport( 'joomla.filter.output' );
  
  $tabela = $this-&gt;get('getCode');
  $code = $tabela[0][0];
  ?&gt;
  
  &lt;form action="index.php?option=com_sblog&amp;view=statistic_adm" method="post" name="adminForm"&gt;
  
  &lt;label&gt;Kod bloga:&lt;/label&gt; &lt;input type='text' name='code' value="&lt;?php echo $tabela[0][0]; ?&gt;" /&gt;
  
  &lt;input type="hidden" name="task" value="" /&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>views/statistic_adm/tmpl/view.html.php</p>
  
  <pre><code>&lt;?php
  defined('_JEXEC') or die('Restricted access');
  jimport('joomla.application.component.view');
  
  class sblogViewStatistic_adm extends JView
  {
      function display($tpl = null)
      {
          JSubMenuHelper::addEntry(JText::_('Ustawienia'), 'index.php?option=com_sblog&amp;amp;view=statistic_adm', true);
          JToolBarHelper::title( JText::_('System blogowy'), 'generic.png' );
  
          $task   = JRequest::getCmd('task');    
          $model = &amp;$this-&gt;getModel('statistic_adm');
  
          //$model=JFactory::getDBO();
          $getCode = $model-&gt;getCode();
          $this-&gt;assignRef('getCode', $getCode);
  
          $this-&gt;addToolBar();
          parent::display($tpl);
      }
       protected function addToolBar() {          
          if (JRequest::getVar('layout') != 'edit')  
          {  
              JToolBarHelper::save('save','Zapisz');
          }
      }  
  }
  </code></pre>
  
  <p>I appreciate any help.</p>