123456789101112131415161718192021 |
- <?php
- class DBProvider {
- function connect()
- {
- global $DB_NAME;
- global $DB_HOST;
- global $DB_USER;
- global $DB_PASSWD;
-
- $dns = "mysql:host={$DB_HOST};dbname={$DB_NAME}";
- return new PDO($dns, $DB_USER, $DB_PASSWD);
- }
- function connect_with_param($host, $user, $passwd, $dbname)
- {
- $dns = "mysql:host={$host};dbname={$dbname}";
- return new PDO($dns, $user, $passwd);
- }
- }
|