[eluser]Unknown[/eluser]
Hai...everyone.
I cannot display my data from database but blank screen displayed. I think my code (conttroler,view & model) is right...but, i dont know what wrong. this screenshoot my code:
controller :
display.php
<?php
class Display extends Controller {
function Display()
{
parent::Controller();
$this->load->model('display_model');
$this->output->cache(120);
}
function index()
{
$data['title'] = "Data on Database";
$data['display_data'] = $this->display_model->SelectData(); //"data";
$this->load->view('display/index',$data);
}
}
?>
model : display_model.php
<?php
class Display_model extends Model {
function Display_model()
{
parent::Model();
}
function SelectData()
{
$this->db->orderby('function_name');
$this->db->limit(10);
$query = $this->db->get('function');
if ($query->num_rows > 0)
{
$output = '<table>';
$output. = '<tr><td>Function Name</td><td>Function Description</td></tr>';
foreach ($query->result as $row)
{
$output. = '<tr><td>'.$row->function_name.'</td>';
$output. = '<td>'.$row->function_description.'</td></tr>';
}
$output. = '</table>';
return $output;
}
else
{
return '<p>Sorry, no results returned.</p>';
}
}
}
?>
view : index.php on display folder.
<?php
$this->load->view("header");
?>
<h2><?= $title; ?></h2>
<div id="function_description">
<?= $display_data;?>
</div>
<?
$this->load->view("footer");
?>
so, I hope everyone can help me...coz, I'm newbie on CI...thanks for your kind help & support.