RE: [PHP] Classes - Dumb question
| From: | Jay Blanchard | Date: | Thu, 11 Oct 2007 15:25:07 +0000 |
| Subject: | RE: [PHP] Classes - Dumb question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-263108@lists.php.net to get a copy of this message | ||
[snip]
Not trying to hijack the thread... Hopefully this is related enough,
if not I apologize. Would a good use of a class be to write a generic
database connection script? and then feed in the different variables,
such as customer login, database, stuff like that?
something like class DBConnect {
// Connect to database
mysql_connect($server, $login, $password, $database);
}
or no?
[/snip]
I don't think so because it is inefficient...wrapping an existing stand-alone function is sort
of redundant. If you were writing a database abstraction layer that would be a horse of a different
color.