note 50662 deleted from function.mysql-connect by didou
| From: | didou@php.net | Date: | Mon, 07 Mar 2005 07:40:25 +0000 |
| Subject: | note 50662 deleted from function.mysql-connect by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-86026@lists.php.net to get a copy of this message | ||
Note Submitter: antido at gmail dot com
Reason: bad code
----
Just a simple connecting class
<?
Class connection
{
var $host;
var $username;
var $password;
var $db;
function connection($host1, $username1, $password1, $db1)
{
$this->host = $host1;
$this->username = $username1;
$this->password = $password1;
$this->db = $db1;
}
function connect($host1, $username1, $password1, $db1)
{
DEFINE("HOST", "$host1");
DEFINE("USER", "$username1");
DEFINE("PASS", "$password1");
DEFINE("DATA", "$db1");
$connect = mysql_connect(HOST, USER, PASS)
or printf("<br>Could not connect to mysql host<br>");
$dbselect = mysql_select_db(DATA)
or printf("Could not select database<br>");
}
}
$connect = new connection();
$connect->connect("localhost", "user", "pass", "db");
?>