par Fesch » 14 Nov 2003 20:23
Pour PHP:
<BR>
<BR>
<BR>$db_server='127.0.0.1';
<BR>$db_user='...';
<BR>$db_pwd='...';
<BR>
<BR>$DATABASE = mysql_connect($db_server,$db_user,$db_pwd) or db_die("Error while connecting to the database ...");
<BR>mysql_select_db($db_db);
<BR>
<BR>//fonction d'aide
<BR> function db_die($error = "inconnue")
<BR> {
<BR> global $db_type;
<BR> $error=str_replace("'", "'",$error);
<BR> $error=str_replace("n", "", $error);
<BR> $error=str_replace("r", "", $error);
<BR> if($db_type=='mysql') {echo "<script>alert('".$error." => ".str_replace("n","",str_replace("'", "'",mysql_error()))."');</script>";}
<BR> if($db_type=='sybase') {echo "<script>alert('".$error." => ".str_replace("n","",str_replace("'", "'",sybase_get_last_message()))."');</script>";}
<BR> exit;
<BR> }
<BR>
<BR>!!! Il faut que ton utilisateur ait accès en local, c'est à dire "username@localhost" ou "username@127.0.0.1" dans le usermanagement de MySQL ...
<BR>
Pourquoi lis-tu ceci???