Jump to content

DB


unidox

Recommended Posts

I don't think that you should "include" the db class so much as pass a db object to the login class to use..

 

If you are asking how to include the file on every page, you can write the __autoload($arg) function

autoload

(be sure to read the notes on making this a safe include/require)

 

 

if you're asking about just USING the class in your other classes.. I usually create a $db object in the global scope, and pass it to my other class...  i also use one instance.

 

$db = MYSQL::getInstance('host','un','pw','database');

$auth = new Auth($db,$arg,$arg);

 

Inside Auth I can use it such as:

$sql = "SELECT username FROM myTable WHERE username='xtopolis'";

$result = $db->query($sql);

Link to comment
https://forums.phpfreaks.com/topic/136787-db/#findComment-714405
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.