Cammoy
11/11/2013 - 12:42 AM

Connect to MySQL DB OO Style

Connect to MySQL DB OO Style

define(	"DB_HOST" , "localhost" );
define(	"DB_NAME" , "" );
define(	"DB_USER" ,	"" );
define(	"DB_PASS" , ""	);

$mysqli = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}
else {
	 echo 'connected';
}