[Error] Undefined property: Accueil::$db |
[eluser]Unknown[/eluser]
Hello ! I am trying to reproduce the basic CI Tutorial where you produce a blog and change it a little bit so that it maches the project I am working on. Unfortunately I keep getting the same error : Code: A PHP Error was encountered My controller goes like this : Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); My Controller_view goes like this : Code: <div id='box_lien'> I hope you can help me understand why CI will not let me use the db->get function like I would want to. After googling this error, it seems to be related to Doctrine. Things I have tried : -Reinstalling Doctrine ORM as a plugin. -Reinstalling Doctrine ORM as a helper. -Adding doctrine to config/autoload.php as (librarie/plugin/helper etc...) -Adding database to config/autoad as a librarie. -Following these setup instructions : http://www.phpandstuff.com/articles/code...-and-setup http://www.joelverhagen.com/blog/2011/05...right-way/ - And that is pretty much it ! I really hope you guys can help me out !
[eluser]Aken[/eluser]
You're using a standard CodeIgniter Active Record way of accessing the database on this line: Code: $data['query'] = $this->db->get('lien'); The error is because you haven't loaded the database through CI. But it seems like you should be using Doctrine methods to retrieve info, not CI's active record...
[eluser]Unknown[/eluser]
Hi ! Thank you for such a quick awnser. You are right, I didn't realize I was trying to use a Active Record way. I will use Doctrine methods such as : Code: <?php I found most ways here : http://docs.doctrine-project.org/project...rimary-key Have a great day, Aryahell |
Welcome Guest, Not a member yet? Register Sign In |