Welcome Guest, Not a member yet? Register   Sign In
cannot load data from database, the result is blank screen
#1

[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>';
}

}

}
?&gt;

view : index.php on display folder.

&lt;?php
$this->load->view("header");
?&gt;
<h2>&lt;?= $title; ?&gt;</h2>

<div id="function_description">
&lt;?= $display_data;?&gt;
</div>
&lt;?
$this->load->view("footer");
?&gt;

so, I hope everyone can help me...coz, I'm newbie on CI...thanks for your kind help & support.


Messages In This Thread
cannot load data from database, the result is blank screen - by El Forum - 06-02-2008, 04:39 AM



Theme © iAndrew 2016 - Forum software by © MyBB