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

[eluser]Civet[/eluser]
controller class
Code:
class Blog extends Controller
{
    
    public function __construct()
    {
        parent::Controller();
        
        $this->load->scaffolding('E_DMV_LOGIN');
    }

E_DMV_LOGIN is a test table in the oracle db.

In the routes.php I've set
Code:
$route['default_controller'] = "blog";
$route['scaffolding_trigger'] = "test";

URL:
Code:
http://localhost/codeigniter/index.php/blog/test
#12

[eluser]solkatten[/eluser]
I have the same problem trying to connect to a Oracle database.
I am doing the second video tutorial about creating a blog i 20 minutes.
Code:
A PHP Error was encountered
Severity: Notice

Message: Undefined property: stdClass::$numrows

Filename: oci8/oci8_driver.php

Line Number: 476

Under the error message the scaffolding for the blog is shown and if i click on the link Create New Record I get a lot of errors, like:

Code:
A PHP Error was encountered
Severity: Notice

Message: Undefined property: stdClass::$primary_key

Filename: views/add.php

Line Number: 11

and

Code:
A PHP Error was encountered
Severity: Notice

Message: Undefined property: stdClass::$default

Filename: views/add.php

Line Number: 19

" size="60" />
#13

[eluser]solkatten[/eluser]
I followed this tutorial:
http://net.tutsplus.com/videos/screencas...tch-day-1/

and the errors didn't appear. I don't know why thou.
#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'; ?>




Theme © iAndrew 2016 - Forum software by © MyBB