For testing purpose, called register.php in Advanced REST client then received above error message.
Could you please let me know how to resolve this issue.
Thanks in advance.
Thank you so much sir for your kind help.
However I have received that code from my colleague which is working fine for him but facing issue for me for null operation on prepare() method in db_functions.php at line 21, not sure why?
I would be grateful if you could find bug in my code meanwhile I will try your code.
The reason for the error is because wherever you copied php’s OOP (Object Oriented Programming) syntax for a constructor from didn’t include actually learning the meaning and requirements for defining a constructor (programming is a written subject and you must actually learn the meaning of the syntax you are writing.) Two __ underscores are part of the name for the constructor, not one.
Next, this code is not what OOP is about. You shouldn’t be adding class/method definitions around parts of your main procedural code and calling it OOP. All that is doing is adding an unnecessary layer of syntax, that doesn’t add any value to what you are doing. You have 9-10 lines of code and unused/unneeded properties, who’s only purpose is to execute the 2 actual lines of code needed to make the database connection, which is missing useful error handling. Does that seem like using this method (programming pun intended) saved you any time writing the code? User written classes, methods, and functions should be general purpose, reusable, building blocks, that do something useful, that eliminate repetition, and make it easier to write applications. If you want to do something useful, extend the database extension you are using, with a general purpose query method, that accepts a second optional array parameter of prepared query input values to control if a prepared or a non-prepared query is used, that also adds useful error handling (using exceptions for errors), that will make it easier for you to write the database potion of your application without repeating the same lines of code over and over for each query.