My registeration system does not work! idk why!

system.php
http://pastebin.com/B7dxr94b

register.php
http://pastebin.com/ktfVP12Y

I try to register an new account to the system and I don’t succeed :frowning:
It doesn’t even say anything, it only shows my this sign:  and this stupid error:

( ! ) Fatal error: Call to undefined function connect_db() in C:\wamp\www\system.php on line 20

I used a php validator, and it doesn’t find any problem by the pages separately.

HELP ME SOMEONE WHO UNDERSTANDS! :frowning:

Your function is part of the register class. You are referring to a function that is not part of a class so it doesn’t see it. You can read about OOP in PHP at http://php.net/manual/en/language.oop5.php for more info. If you are unable to figure that out then you could also create the function outside of the register class.

In which line is the problem in?
…and how can I fix it?

Line 20 where you are calling the function. The function you are calling is in the register class. For you to call it, you have to reference the register class first. Try this instead:

[php]$connect = register::connect_db();[/php]

Let me know if that works.

Now it doesn’t write anything. not even .
Just nothing.

Can anybody help me? My problem isn’t solved!

I believe you simply need to change that line to:

[php]$connect = $this->connect_db();[/php]

One other issue is that you are creating a database connection in many many routines. You should only create one connection. You should not reopen the connection every time a function is used. But, if you want to do that , you could, but, you would have to close the connection at the end of each function that opens it. Otherwise, you will put unneeded stress on the server and have too many connections opened which will cause errors eventually. Usually you open the connection once per page OR you close the connection after it’s use. Hope this helps you along with the function reference error.

Sponsor our Newsletter | Privacy Policy | Terms of Service