note 41838 added to function.mysql-connect
| From: | eric at manas dot kg | Date: | Fri, 23 Apr 2004 12:13:25 +0000 |
| Subject: | note 41838 added to function.mysql-connect | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-68658@lists.php.net to get a copy of this message | ||
You wrote this at
http://my.php.net/manual/en/function.mysql-connect.php
****************************
<?php
class DB {
function DB() {
$this->host = "mysql.host.com";
$this->db = "myDatabase";
$this->user = "root";
$this->pass = "mysql";
$this->link = mysql_connect($this->host, $this->user, $this->pass);
mysql_select_db($this->db);
}
}
?>
And then, on each of your pages, include the file with your database class, and then...
<?php
$DB = new DB;
?>
********************************
what will if i will use another database? i'm new to this. thanks.
----
Manual Page -- http://www.php.net/manual/en/function.mysql-connect.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+41838
Delete -- http://master.php.net/manage/user-notes.php?action=delete+41838&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+41838&report=yes
Search -- http://master.php.net/manage/user-notes.php