Welcome Guest, Not a member yet? Register   Sign In
Call to a member function Create() on a non-object
#1

[eluser]Ludatha[/eluser]
Hey I am new to CI and I want to change my current site to use it.
I have downloaded the library SimpleLoginSecure and cannot seem to get it working.

This is my complete code.
Code:
<?php
class Profile extends Controller {    
    function index()
    {
        $this->load->library('SimpleLoginSecure');
        $this->SimpleLoginSecure->Create('usernamehere', 'passwordhere');
    }
}
?>

Errors:

A PHP Error was encountered
Severity: Notice
Message: Undefined property: Profile::$SimpleLoginSecure
Filename: controllers/profile.php
Line Number: 6

Fatal error: Call to a member function Create() on a non-object in D:\wamp3\www\php\system\application\controllers\profile.php on line 6

When things go wrong it is generally something obvious so I apologise if it is.

- Adam
#2

[eluser]Dam1an[/eluser]
Is the Simpleloginsecure file in the libraries folder? Is the filename got the first letter in upper case?

Could try manually incluing it and creating the object yourself instead of using the loader, see if that works
#3

[eluser]Ludatha[/eluser]
Thanks for the reply, I tried this code:

Code:
<?php
class Profile extends Controller {    
    function index()
    {
        include('D:\wamp3\www\php\system\application\libraries\SimpleLoginSecure.php');
        $cheese = new SimpleLoginSecure;
        $cheese->SimpleLoginSecure->Create('usernamehere', 'passwordhere');
    }
}
?>

But I get exactly the same error except the line number is 7

Message: Undefined property: SimpleLoginSecure::$SimpleLoginSecure
#4

[eluser]Dam1an[/eluser]
it should be
Code:
$cheese = new SimpleLoginSecure();
$cheese->create(.....
#5

[eluser]Ludatha[/eluser]
Oh yeah, Shows how much I remember things =)

Changed the code, but a different error this time. I've had this before.
Code:
<?php
class Profile extends Controller {    
    function index()
    {
        include('D:\wamp3\www\php\system\application\libraries\SimpleLoginSecure.php');
        $cheese = new SimpleLoginSecure();
        $cheese->Create('usernamehere', 'passwordhere');
    }
}
?>

A PHP Error was encountered

Severity: Notice

Message: Undefined property: Profile::$db

Filename: libraries/SimpleLoginSecure.php

Line Number: 61


Fatal error: Call to a member function where() on a non-object in D:\wamp3\www\php\system\application\libraries\SimpleLoginSecure.php on line 61
#6

[eluser]Dam1an[/eluser]
I'm guessing you havn't loaded the database class? I'd recommend adding it to autoload in the config directory
#7

[eluser]Ludatha[/eluser]
Oh, it works now Smile

Thanks for your help!
#8

[eluser]Dam1an[/eluser]
The Damianmeister does it again Smile
Is it working through $this or just by creating an object?
#9

[eluser]Ludatha[/eluser]
Oh, I just changed it back to $this

and I am back to square one... Tongue

A PHP Error was encountered

Severity: Notice

Message: Undefined property: Profile::$SimpleLoginSecure

Filename: controllers/profile.php

Line Number: 6


Fatal error: Call to a member function Create() on a non-object in D:\wamp3\www\php\system\application\controllers\profile.php on line 6
#10

[eluser]Dam1an[/eluser]
Hmm, the only thing I can think of, is you have 2 variables with the same name 9although its unlikely with something like SimpleLoginSecure) and the second one is overwriting yours, and doesn't have the create method




Theme © iAndrew 2016 - Forum software by © MyBB