[eluser]sasori[/eluser]
this is my controller function
Code:
function index()
{
$data['base'] = $this->config->item('base_url');
$data['css'] = $this->config->item('css');
$this->load->model('stock_model');
$stocks = $this->stock_model->getStocks();
$this->load->library('pagination');
$config['base_url'] = 'http://myapp/welcome/stocks/';
$config['total_rows'] = '20';
$config['per_page'] = '10';
$this->pagination->intialize($config);
$this->load->view('stocks_view',$data);
}
and this is my views code
Code:
<table border="1">
<tr class="heading">
<td>Price Percent_change</td>
<td> Company Name</td>
<td> Company Code</td>
<td> Volume</td>
</tr>
<?php
foreach($stocks->result() as $row)
{
echo "<tr>";
echo "<td>".preg_replace("/\s+/"," ",$row->pricepercent)."</td>";
echo "<td> ".$row->compname."</td>";
echo "<td> ".$row->compcode."</td>";
echo "<td> ".$row->volume."</td>";
}
?>
</table>
<?php echo $this->pagination->create_links(); ?>
I am getting this error
Quote:A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI_Loader::$pagination
Filename: views/stocks_view.php
Line Number: 31
and this one
Quote:Fatal error: Call to a member function create_links() on a non-object in C:\xampp\htdocs\myapp\system\application\views\stocks_view.php on line 31
where line 31 is this one
Code:
<?php echo $this->pagination->create_links(); ?>
what should i do ?