Im working on a pre created joomla component which using the MVC Architecture, My problem like this:
In Models i have a .php file with database fetch function as
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.application.component.model' );
class class_name extends JModel
{
var $_data;
function getlast_year(){
$query = 'SELECT year FROM `table` ORDER BY year DESC LIMIT 0,1';
$this->_db->setQuery( $query );
return $this->_db->loadResult();
}
}
I added a new function to the same class file: (I have updated the table columns too in MVC /tables)
as:
function getAttendenceData()
{
$query="SELECT id,octSec,octNin,octSect,octSec,octTwent FROM `table`";
$this->_db->setQuery( $query );
//$this->_data = $this->_db->loadObjectList();
$this->_data = $this->_db->loadObject();
return $this->_db->loadObjectList();
}
but in view i cant still access the fetched data from the above new function but older functions are working property
print_r($this->_db->loadObjectList())in above function. 2. If yes, then what's the code in the view where you're accessing this data?Vikkquery works fine. i access data as$this->data as $rthen$r->iddata fetches from older functions are fetched fine only the problem with the new functionview.html.phpfile of your view.$items= & $this->get( 'Data');