Skip to content

Instantly share code, notes, and snippets.

@gyprosetti
Created January 1, 2014 02:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gyprosetti/715e2344708256acaf23 to your computer and use it in GitHub Desktop.
Save gyprosetti/715e2344708256acaf23 to your computer and use it in GitHub Desktop.
Connect to database
<?php
error_reporting(E_ERROR);
//Connection To MYSQL DataBase
//Function called in external scripts
function DBConnect(){
//add further global vars at the end of the line below once you have created them in the database admin tool
global $Host, $User, $Password, $DBName, $Table_1, $Table_2, $Table_3;
$Host = "host";
$User = "me";
$Password = "opensesame";
$DBName = "mydatabase";
//add links to new tables here
$Table_1 = "admin";
$Table_2 = "registration";
$Table_3 = "comments";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment