Click here to Skip to main content
15,895,557 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I'm creating a login/register system and I got this error
Fatal error: Call to a member function passed() on a non-object in D:\ProgramFile\Xampp\htdocs\site\shop\register.php on line 28
my code is
http://pastebin.com/RLPAKUEA[^]
http://pastebin.com/2HU4yLVu[^]

Thank you in advance.
P.S. Sorry if I'm noob I'm very new to OOP/PDO.
Posted
Comments
Richard MacCutchan 23-Nov-14 7:34am    
Please show the actual code where the error occurs, rather than links to pictures.
Sergey Alexandrovich Kryukov 23-Nov-14 14:10pm    
In what line? Why not posting your code on this page?
The problem is very simple, you just need to fix some bug...
—SA
Theminer3746 23-Nov-14 21:21pm    
The error occurred when I call $validation->passed() which will return $this->_passed;

1 solution

There seem not to be anything wrong with the codes you posted. The bug meant be hidden somewhere else probably in your class config, because this is the only code that will run when you call ->passed().
PHP
private function __construct(){
        try {
            $this->_pdo = new PDO(
            'mysql:host=' . config::get('mysql/host'),//get host name
            'dbname=' . config::get('mysql/db'),//get database name
            config::get('mysql/username'),
            config::get('mysql/password'));
        } catch (PDOException $e){
                die($e->getMessage());
            }
    }
 
Share this answer
 
Comments
Theminer3746 25-Nov-14 20:52pm    
Thanks for help I just got the passes() method to work. But after that I call
$this->_query = $this->_pdo->prepare($sql)
which create the Fatal error: Call to a member function prepare() on a non-object.
So my question is now why $this->_pdo is not callable?
Oso Oluwafemi Ebenezer 26-Nov-14 2:12am    
If you are still using the code you posted earlier, what did you expect? class Validate as no method _pdo (you are using $this on it, see?). But I doubt you are still using the code anyway, because I can't figure out where the ->prepare came from.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900