can sombody give me a great example to make a connection php - mysql ( oop - best practice ) ?
<?php
/* Database Connection */
class db
{
private $db['host']='localhost';
private $db['user']='root';
private $db['pass']='';
private $db['name']='build';
public function connect($db['host'],$db['user'],$db['pass'])
{
$db['connect'] = mysql_connect($db['host'],$db['user'],$db['pass']);
if (!$db['connect']) {
printf("Cannot connect to database: %s\n", mysql_error())
}
else
{
echo "Connected";
}
// end funtion
}
// end class
}
?>
i dont know what cause this error above ( mycode )
sry newbie