Skip to content

Instantly share code, notes, and snippets.

function dbConnect($sql_hostName, $sql_Username, $sql_Password, $dbName = '') {
$server = $sql_hostName;
$name = $dbName;
$username = $sql_Username;
$password = $sql_Password;
$dsn = 'mysql:host='.$server.';dbname='.$name;
try {
$db = new PDO($dsn, $username, $password);