Code Ignator Nothing happens database
Hi I am following a turtorial to learn codeIgnator on the Net tuts site. link
I have One model one view and one controller involved..
The Model:
class Data_model extends CI_Model{
function getAll(){
$data = array();
$q = $this->db->query("SELECT * FROM data");
if($q->num_row() > 0){
foreach($q->result() as $row){
$data[] = $row;
}
return $data;
}
}
}
The Viewer:
<html>
<head>
<title></title>
</head>
<body>
<p>View loaded</p>
<?php
foreach ($rows as $r){
echo '<h1>',$r->title,'</h1>';
}
?>
</body>
The Controller:
class Site extends CI_Controller{
function index(){
$this->load->model('data_model');
$data['rows'] = $this->data_model->getAll();
$this->load->view('home');
}
}
The problem is that i dont get an error but just a empty white site. What
am i doing wrong it feels like i am doing everything in the turtorial?
No comments:
Post a Comment