Jump to content

Best way too...


pbjorge12

Recommended Posts

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?
Link to comment
Share on other sites

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 ?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.