global file to connect to MySQL with php

$login= "";                              // user name for you database
$pass= "";                                   // pass word to the database if you dont have a password 
						//set up leave it as ""
$database_name="";                     //name of the database

/* Don't change anything below this line                                                        */                                                   

function connect_db()
	global $pass,$login;
	$db=mysql_connect("localhost",$login,$pass) or  die("Unable  to  select  database");
	return $db;

function db_name()
	global $database_name;
	return $db_name;

Then, on each file where you need MySQL connection, include:

#connect to database
  • info/
  • Dernière modification : 2018/07/18 09:45
  • de radeff