Return to Snippet

Revision: 23173
at February 1, 2010 05:42 by ginoplusio


Initial Code
define("WEBDOMAIN", "your host");
define("DEFDBNAME", "your db name");
define("DEFUSERNAME", "your user");
define("DEFDBPWD",  "your pwd");

if(!$conn = connectDb()) {die("err db");} else {$conn->query("SET NAMES 'utf8';");}

function connectDb() {
	if ($conn = @new mysqli(WEBDOMAIN, DEFUSERNAME, DEFDBPWD, DEFDBNAME)) return $conn; else return false;
}

Initial URL
http://www.barattalo.it/2010/01/29/10-php-usefull-functions-for-mysqli-improved-stuff/

Initial Description


Initial Title
MySQLi connection

Initial Tags
mysql, php

Initial Language
PHP