Skip to content
Advertisement

PHP code convert to PHP/MySQLi OOP

today i tried to convert my code to PHP/MySQLi OOP code.

JavaScript

This is a script for the query’s:

JavaScript

And this is how i call it.

JavaScript

I alway get a “Call to a member function query() on a non-object”. Doesn’t matter what i trie …

Can somebody tell me why that is?

Thanks!

Advertisement

Answer

I think while you definitely need to have $mysqli as public so it can be accessed in the other method, there might be something else, as the error would be something like

trying to access private property in database class

or something like that, whereas your script throws a non-object call error

I think your new Adressen_Db; lacks the parenthesis:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement