10-06-2009, 08:48 AM
(10-05-2009, 05:30 PM)xiofire Wrote: Hmm... Shorthand? Yuck.
Heres how I connect to my databases
Code:<?php
class connection {
private $database, $connect;
function connect() {
$this->database = array(
'username' => 'USERNAME',
'password' => 'PASSWORD',
'host' => 'localhost',
'name' => 'DATABASE NAME'
);
$this->connect = mysql_connect($this->database['host'], $this->database['username'], $this->database['password']);
mysql_select_db($this->database['name'], $this->connect);
}
}
$db = new connection();
$db->connect();
?>
Correct, simple and easy enough.. Good work ;)