![]() |
Call to a member function userdata() on a non-object - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Call to a member function userdata() on a non-object (/showthread.php?tid=41494) Pages:
1
2
|
Call to a member function userdata() on a non-object - El Forum - 05-09-2011 [eluser]djkemical[/eluser] Hi everybody I have a code that give me this error Code: Call to a member function userdata() on a non-object in C:\wamp\www\ci\application\libraries\centinela.php on line 19 The code of centinela.php is Code: <?php Call to a member function userdata() on a non-object - El Forum - 05-09-2011 [eluser]InsiteFX[/eluser] For one you do not need to use the $CI-> Super Object in a Controller! Just autoload the database and session libraries... InsiteFX Call to a member function userdata() on a non-object - El Forum - 05-11-2011 [eluser]djkemical[/eluser] Thanks for your reply. The centinela.php is not a controller, is a library Call to a member function userdata() on a non-object - El Forum - 05-11-2011 [eluser]InsiteFX[/eluser] Then why are you extending it as a CI_Controller? InsiteFX Call to a member function userdata() on a non-object - El Forum - 05-11-2011 [eluser]djkemical[/eluser] Up's... I fixed the code, but it gives me the same error. Code: <?php Call to a member function userdata() on a non-object - El Forum - 05-11-2011 [eluser]InsiteFX[/eluser] This should be __construct not Centinela: Code: function __construct($auto = TRUE) InsiteFX Call to a member function userdata() on a non-object - El Forum - 05-11-2011 [eluser]danmontgomery[/eluser] Code: $CI->load->library('session'); Call to a member function userdata() on a non-object - El Forum - 05-11-2011 [eluser]InsiteFX[/eluser] @noctrum, I told him to autoload the session library, but not sure if he did! InsiteFX Call to a member function userdata() on a non-object - El Forum - 06-07-2011 [eluser]why.you.and.i[/eluser] Hello, i'm new at CI and i'm having almost the same problem here. It's my error: MY ERROR: A PHP Error was encountered Severity: Notice Message: Undefined property: Hello::$Hello_model Filename: admin/hello.php Line Number: 15 Fatal error: Call to a member function getData() on a non-object in /Applications/XAMPP/xamppfiles/htdocs/c4/application/controllers/admin/hello.php on line 21 MY CODE: Here is my controller (hello.php) Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); And my models (hello.php) Code: <?php WHAT I'VE TRIED If i change my model and call the function directly by using Code: $data['result'] = Hello_model::getData(); application/config/autoload.php Code: $autoload['libraries'] = array('database'); Is there something i'm missing? Thank you for your time. Call to a member function userdata() on a non-object - El Forum - 06-07-2011 [eluser]InsiteFX[/eluser] You did not show your view file, but in your view file you will need to use a foreach loop to loop through the returned result set! This is why your getting the error! Code: function index() InsiteFX |