Welcome Guest, Not a member yet? Register   Sign In
Scaffolding and Oracle 9i
#14

[eluser]solkatten[/eluser]
Sorry, the errors did appear.
But I used one file each for controller, model and view.
My solution was:
The controller
Code:
<?php

class Blog extends Controller{

function Blog()
{
    parent::Controller();
    
    $this->load->helper('url');
    $this->load->helper('form');
}
    
function index()
{
    $this->load->model('blog_model');
    $data['records']=$this->blog_model->getAll();
    $this->load->view('blog-view', $data);

}
}
?>

The view
Code:
<html>
<head>
<title></title>
</head>
<body>

<?php

foreach($records as $row)
{
    echo $row['TITLE'];  //Capital letters or it won't work
}
?>
</body>
</html>

The model
Code:
<?php

class Blog_model extends Model{

function getAll()
{
    $query=$this->db->get('blog');
    
        foreach($query->result_array() as $row)   //_array() or it won't work
        {
            $data[]=$row;
        }
    return $data;
}
}
?>

So it's more PHP than CodeIgnitor.

I can't use the short version of PHP like
<?=echo 'Test'; ?>
I must do the whole thing
<?php echo 'Test'; ?>


Messages In This Thread
Scaffolding and Oracle 9i - by El Forum - 02-27-2009, 01:38 PM
Scaffolding and Oracle 9i - by El Forum - 02-27-2009, 02:18 PM
Scaffolding and Oracle 9i - by El Forum - 02-28-2009, 06:31 AM
Scaffolding and Oracle 9i - by El Forum - 02-28-2009, 06:36 AM
Scaffolding and Oracle 9i - by El Forum - 09-25-2009, 08:58 PM
Scaffolding and Oracle 9i - by El Forum - 10-14-2009, 08:49 AM
Scaffolding and Oracle 9i - by El Forum - 10-15-2009, 07:48 AM
Scaffolding and Oracle 9i - by El Forum - 10-15-2009, 10:23 AM
Scaffolding and Oracle 9i - by El Forum - 10-19-2009, 02:22 AM
Scaffolding and Oracle 9i - by El Forum - 10-19-2009, 08:03 AM
Scaffolding and Oracle 9i - by El Forum - 10-21-2009, 04:29 AM
Scaffolding and Oracle 9i - by El Forum - 02-16-2010, 02:25 AM
Scaffolding and Oracle 9i - by El Forum - 02-17-2010, 01:54 AM
Scaffolding and Oracle 9i - by El Forum - 02-17-2010, 04:06 AM



Theme © iAndrew 2016 - Forum software by © MyBB