pbjorge12 Posted April 18, 2006 Share Posted April 18, 2006 I am wodnering what the best way is too do this...I have an sql class (ezsql) and an authentication class that gets its data from a database.What is the best way to get the authentication class to use the sql class used throughout the rest of the site? Would it be to pass the sql object in the authentication class's constructor? Quote Link to comment Share on other sites More sharing options...
ypirc Posted April 18, 2006 Share Posted April 18, 2006 Why don't you just require the class file and call it like you would any other time? Remember, classes are meant to be objects, you don't need to pass things around like that. For instance, let's assume a test authentication script...without actual code of course.[code]require 'sql.php'<blah blah blah>$sql = new sql();$sql->function('hey');OR ... if you decide to do your classes using the scope resolution operator, you'd do it like this:require 'sql.php'<blah blah blah>SQL_CLASS_NAME::function('hey');[/code]Does that help ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.