I’ve finally gotten around to working through the second video tutorial for CodeIgniter. It’s centered around creating a blog in about 20 minutes (it continues from the shorter, “Hello World” intro tutorial…so if you haven’t already, I’d start from there).
There’s a small error I didn’t notice (but should have). It had me stumped for a bit but, as is most always the case, the solution was painfully obvious.
I’ve got the video running and am coding along as the guy speaks. Pretty early on, when setting CodeIgniter to automatically connect to a particular database, you’re instructed to open system/application/config/autoload.php file to modify the $autoload['core'] array to include the database “core library”.
/* | ------------------------------------------------------------------- | Auto-load Core Libraries | ------------------------------------------------------------------- | | DEPRECATED: Use $autoload['libraries'] above instead. | */ $autoload['core'] = array('database');
A little later, after creating a couple of database entries and setting the page to display their values, I was greeted with the following error:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Blog::$db
Filename: controllers/blog.php
Line Number: 16
The call to $this->db->get failed because the $db member of Blog (which extends CodeIngiter’s Controller class) didn’t exist.
You know why? Did you actually read the comments in the php code above? I didn’t. I was quickly moving around and typing while the tutorial played. If you didn’t notice it the first time, reread them now.
See it? Nice and big and all-caps: DEPRECATED. “Use $autoload['libraries'] above instead.” Which I did and then it worked.
Lesson learned, right? Always read the comments.
THANKS FOR THE HELP!! NOTED
read comments? … lol. Thanks!!
lmfao, this had me stumped
wonderful
ya i had that problem see those tutorials are from when it was done that way they haven’t been updated in a while, so i have now decided i will make a new video tutorial series for code Igniter and host it on my own website.(i am not associated with ellislab in anyway)
i will post a link to them here
i forgot i will also post them on the CodeIgniter Forum