last day (14 days later) » 

11:41 AM
1
A: CodeIgniter -Error Call to a member function model() on a non-object

Harigovind RMy controller-insert_ctrl.php class insert_ctrl extends CI_Controller{ function __construct() { parent :: __construct(); $this->load->model('insert_model'); } function index() { $this->insert_model->form_insert(); echo "Clear"; } } My Model- insert_model.php cl...

 
Yes please point me the place to edit
I just posted my updatd code as well.Um sorry I didn't get what u said me to change correctly.
 
i will give you a test code which i used to reproduce your error. Will that be enough?
 
yes sure!! I will try through that
 
@Akisha just try it out. Ask me if you are missing something
 
Thank you soo much! I'll try this one
 
11:41 AM
@Akisha okey let me know if its working
 
I must be definetly doing something wrong inside. This gives me an error as well. I'm really new to this. Anyway thanx a lot for your support! Um really thank ful
 
@Akisha are you getting the same error?
 
No actually my problem is I couldn't run the program. It gave me an error when I was trying
 
@Akisha What is the error message you are getting. The process is a bit tricky at first i also had many problems with CI but eventually it gets better. Give me the error details. Let me see.. :)
@Akisha I think i found your problem. Your constructor has only one underscore, Whereas constructor is invoked using double underscores. Please try that on your code. Please out two _ symbols before the constructor you have only one here.
 
thnk uuuuu i will try n let u know
Now the constructer is working. But still the same error. A PHP Error was encountered Severity: Notice Message: Undefined property: insert_ctrl::$insert_model Filename: controllers/insert_ctrl.php Line Number: 8
 
11:41 AM
@Akisha your constructor must be like this function __construct() { parent :: __construct(); $this->load->model('Insert_model'); }
@Akisha I will tell you why you are having that error. The first reason is inside the constructor you have to load the model, the second reason is the model that you have loaded does not match with the model that you have tried to call.
 
Ohhh noooo I don't understand this error at all.I'm really sorry for your time! It says like this. Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 65488 bytes) in C:\xampp\htdocs\NewProject\system\core\Loader.php on line 280
yes. But I think I have call them correctly right now. But I don't understand why is this giving me this type of error now
 
@Akisha This is a result of memory limit of php. Check for any infinite loop or high memory usage database query. And i would suggest first you check wether your model is being accessed. I will edit my answer and post my test files which i have renamed according to your files. So you can just copy paste them and try using it. Tell me if you want me to give you the code.
 
Yes of course now it is accessing insert_model. Oki i will try to find about the infinite loop inside
I think the problem is with the codes I followed up. Right nowI was just trying to copy the same codes and try out whether the problem is with my code . When ever I did so it is saying cannot find 'insert_model'. I think thats the problem over here as well.freeonlinelecture.com/2015/02/…
 
@Akisha Okey try out the code i have given and see if that works. The code is just a skeleton code you can fill in the required contents if the model is getting loaded correctly. Hope i was able to help you out?
 
Thank you soo much I will follow this... :)
 
11:41 AM
You are most welcome. If it works please accept this as the answer .@Akisha
 
Thanx a lot again and again. I just tried this but I don't know how it does gives me the same looping error and when ever i comment it then again my previous error! Anyway I seriously don't know how to thank you. Eventhough i wasn't working for me you really gave me so much options. Thank you very much! This is actully more than I accpected. I will try another inserting fuction. :)
 
hey is it okey for you to chat?
Lets find out a solution for your current problem.
 
Um so sorry to truble u like this
Oki Now its fine with my errors and all. I just changed it here and there and now its working . The thing is it is not inserting any value to the database. But it dosn't give me any error either'
 

last day (14 days later) »