1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| <?PHP
define("BASE","nombase1");
define("BASE2","nombase2");
define("HOST","localhost");
define("USER","root");
define("PASS","mdp");
class BaseITES{
var $lien, $resultat;
function BaseThomas(){
$this->lien = NULL;
$this->resultat = NULL;
}
function connecter(){
$this->lien = mysql_connect(constant("HOST"), constant("USER"), constant("PASS"));
if ( !$this->lien ){
die("Could not connect: " . mysql_error());
}
mysql_select_db(constant("BASE"), $this->lien) or die("Select DB Error: " . mysql_error());
}
function connecter2(){
$this->lien = mysql_connect(constant("HOST"), constant("USER"), constant("PASS"));
if ( !$this->lien ){
die("Could not connect: " . mysql_error());
}
mysql_select_db(constant("BASE2"), $this->lien) or die("Select DB Error: " . mysql_error());
}
function deconnecter(){
mysql_close( $this->lien );
}
function effectuer($requete){
$this->resultat = mysql_query($requete, $this->lien) or die("Could not query: " . mysql_error().":".$requete);
return $this->resultat;
}
... |