Welcome Guest, Not a member yet? Register   Sign In
working with models
#1

[eluser]karltingume2007[/eluser]
please, i urgently need help with working with models. i am still quite new in codeigniter and i have this problem at the level of working with models. on loading my model, the code written in that class is brought to the screen followed by the error message:- Fatal error: Class 'Addressbook_model' not found in C:\Program Files\EasyPHP 2.0b1\www\sample\system\core\Loader.php on line 303. am sorry to say this, but to tell you all the truth, i need help and really quickly. thank you
#2

[eluser]ojcarga[/eluser]
1) You are not providing any code example.
2) You should read the guide before ask.
And
3) No, there is not a "3".

Post your code!

Cheers!

#3

[eluser]keevitaja[/eluser]
check your application/models folder if there is addressbook_model.php file in it.
#4

[eluser]karltingume2007[/eluser]
this is my code:
class Addressbook_model extends CI_Model {

var $name = '';
var $phonenum = '';
var $email = '';
var $address = '';

function __construct() {
parent::__construct();
}

function get_last_ten_entries() {
$query = $this->db->get('entries', 10);
return $query->result();
}

function insert_entry() {
$this->name = $_POST['name'];
$this->phonenum = $_POST['phonenum'];
$this->email = $_POST['email'];
$this->address = $_POST['address'];
$this->db->insert('entries', $this);
}

function edit_entry() {
$this->name = $_POST['name'];
$this->phonenum = $_POST['phonenum'];
$this->email = $_POST['email'];
$this->address = $_POST['address'];
$this->db->update('entries', $this, array('name' => $_POST['name'], 'phonenum' => $_POST['phonenum'], 'email' => $_POST['email'], 'address' => $_POST['address']));
}

}
#5

[eluser]keevitaja[/eluser]
without digging into the the code itself, how do you load your model?
#6

[eluser]ojcarga[/eluser]
Try to use [ code ][ /code ] around your code, and also post the code of your controller, at least the part where you load the model and the method where you call the methods contained in Addressbook_model.

Cheers!
#7

[eluser]karltingume2007[/eluser]
i must say i am deeply sorry for having violated any of the rules. this comes as a result of the fact that am still very new in this forum. all the same, i'll do my best to respect all sections of this forum and the rules involved.

i was able to relieve myself of the problem of working with models. thank you all for the kind attention, propositions, and advices you offered.

i have another problem to raise:
i need help in loading a database's content unto a view. could someone give me sample codes that cam make that happen?? i don't know how to go about it at all(i.e i have not written any sample codes even with errors to provide that functionality). PLEASE HELP!!!!!
#8

[eluser]boltsabre[/eluser]
http://codeigniter.com/tutorials/

Go through some of the video tutorials, they will help you get a good idea of how to load models, use helpers, getting database data, manipulating it, displaying it in views, etc. Honestly, that's how I learnt.

Just keep an eye out for older tutorials that talk about naming your controller "Controller" not "CI_Controller", the first one is old, the ci_controller is for the latest versions. If you get stuck, just have a look around on google, almost every simple problem has been answered, you just have to find it ;-)

Good luck.




Theme © iAndrew 2016 - Forum software by © MyBB