A PHP Error was encountered |
[eluser]jiahui[/eluser]
Hello, all experts. What my problem is absolutely same with this article http://ellislab.com/forums/viewthread/45460/#580204 described But, have tried with use the suggestions of that article what I found there, but my problem is still there. This is the error message always appearing at the bottom of my web page. Quote:A PHP Error was encountered Any kindness expert willing to guide me drive to the right path? Following is my source code: 1. In Model : Code: <?php 2. In Controller : Code: function index() 3. views : Code: <?php foreach($accounts->result() as $user):?>
[eluser]John_Betong[/eluser]
[quote author="jiahui" date="1258619670"]Was my question not clear? None feedback?[/quote] http://ellislab.com/forums/viewthread/130302/#653952 Try: 1. download the above function and save it to a file 2. require the function in your index.php Temporarily change these lines of code Code: // return $this->db->get('user'); Once you know the results, move on to your next lines of code. edit: spelling
[eluser]jiahui[/eluser]
I saved the file in views folder. And require the file in my index.php , also changed my query to : Code: $query = $this->db->get('user'); But what I get is Quote:Fatal error: Call to undefined function fred() in C:\inetpub\sgcarmart\hoorfatt\system\application\models\usercontacts_model.php on line 11 Any comments? Thank you
[eluser]John_Betong[/eluser]
[quote author="jiahui" date="1258633508"]I saved the file in views folder. And require the file in my index.php , also changed my query to : Code: $query = $this->db->get('user'); But what I get is Quote:Fatal error: Call to undefined function fred() in C:\inetpub\sgcarmart\hoorfatt\system\application\models\usercontacts_model.php on line 11 Any comments? Thank you[/quote] Save the function in a file called _fred.php in the same directory as your index.php. In your index,php include the file by using require('_fred.php'); If there is any problem with the _fred.php file then your index.php will show an error and stop processing. Including the file shows any errors but continues processing. Once _fred.php is being called correctly the fiunction fred($whatever_variable_you_choose); is then available everywhere in your program. Try it again and let us know the results.
[eluser]jiahui[/eluser]
This is the result list I got: Code: Name ==> [b]missing_$data_name[/b] Could tell me what is the indeed problem caused this error msg appearing all the times? Code: A PHP Error was encountered
[eluser]John_Betong[/eluser]
[quote author="jiahui" date="1258705983"]This is the result list I got: Code: Name ==> [b]missing_$data_name[/b] Could tell me what is the indeed problem caused this error msg appearing all the times? Code: A PHP Error was encountered Please note that the error message returned is not an error it is a warning. You could hide the warning by changing the error level setting. I would be tempted to exactly pinpoint where the message is appearing and then take steps to free the result set by using $result->free_result();. Normally the result set is freed automatically but it appears to be some sort of conflict. To eliminate this I would free the result set every time immediately after I have stored the result set.
[eluser]jiahui[/eluser]
How to do that? Because I intend to set it like this Code: <?php foreach($accounts->free_result() as $user):?> Code: <?php foreachmy sql_free_result(accounts->result() as $user)):?> Could teach me whether got another efficient way to block this msg in front of user?
[eluser]John_Betong[/eluser]
[quote author="jiahui" date="1258710546"]How to do that? Because I intend to set it like this Code: <?php foreach($accounts->free_result() as $user):?> Code: <?php foreachmy sql_free_result(accounts->result() as $user)):?> Could teach me whether got another efficient way to block this msg in front of user?[/quote] Try this: Code: function get_admin_contacts()
[eluser]jiahui[/eluser]
Thank you for your patient. I tried but got this error msg : Quote:Fatal error: Call to undefined method CI_DB_mysql_driver::free_result() in C:\inetpub\sgcarmart\hoorfatt\system\application\models\usercontacts_model.php on line 10 |
Welcome Guest, Not a member yet? Register Sign In |