DaLightz
See ya'll in the afterlife.
- May 19, 2012
- 1,136
- 262
Hello Devbest! This MySQL connector was originaly for one of my old projects, but i figured i'd share it.
Config.php
MySQL.php
And there it is. Simple, and safe. Enjoy :}
Config.php
PHP:
<?php
$_CONFIG['MySQL']['Hostname'] = 'localhost'; //host
$_CONFIG['MySQL']['Username'] = 'root'; //username
$_CONFIG['MySQL']['Password'] = 'fingerme'; //pass
$_CONFIG['MySQL']['Database'] = 'Mydb'; //db
?>
MySQL.php
PHP:
<?php //start the script.
//Gather connection details.
$_MySQL['Connection'] = mysql_connect($_CONFIG['MySQL']['Hostname'],$_CONFIG['MySQL'] ['Username'],$_CONFIG['MySQL']['Password']);
//Does it work?
if (!$_MySQL['Connection'])
{
die('<h1>ERROR!</h1><br><b> ' . mysql_error() . '</b>');
}
//Select db.
mysql_select_db($_CONFIG['MySQL']['Database'], $_MySQL['Connection']);
?>
And there it is. Simple, and safe. Enjoy :}