Comment caché les erreurs mysql

lunick Messages postés 39 Statut Membre -  
 CubeRCL -
Comment caché les erreurs mysql genre Duplicata du champ 'ABCD' pour la clef 2Voici ma requête

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO cartes_msg (ID, ID_MEMBRE, ID_CARTE, `date`, CODE, MAIL_DEST, NOM_DEST, MAIL_ENV, NOM_ENV, OBJET, MESSAGE, ID_SOUND) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['id'], "int"),
                       GetSQLValueString($_POST['ID_MEMBRE'], "text"),
                       GetSQLValueString($_POST['ID_CARTE'], "text"),
                       GetSQLValueString($_POST['date'], "date"),
                       GetSQLValueString($_POST['CODE'], "text"),
                       GetSQLValueString($_POST['V_EMAIL_DEST'], "text"),
                       GetSQLValueString($_POST['V_NOM_DEST'], "text"),
                       GetSQLValueString($_POST['V_EMAIL_ENV'], "text"),
                       GetSQLValueString($_POST['V_NOM_ENV'], "text"),
                       GetSQLValueString($_POST['V_OBJET'], "text"),
                       GetSQLValueString($_POST['V_MESSAGE'], "text"),
                       GetSQLValueString($_POST['ID_SOUND'], "text"));

  mysql_select_db($database_cmixte2, $cmixte2);
  $Result1 = mysql_query($insertSQL, $cmixte2) or die(mysql_error());
A voir également:

1 réponse

CubeRCL
 
Enleve le die(mysql_error()) ... Ceci est la resultante au cas ou ton mysql_query echouerais. Generalement, je fais (merci phpBB):

if( !($result = $db->sql_query($sql)) ) {
message_die(GENERAL_ERROR, 'Could not query url list' . $sql, '', __LINE__, __FILE__, $sql);
}
ou
if( $result = $db->sql_query($sql) ) {
//ca a marche, je fais ...

}
Apluche
Cube
0