Jump to content

Return on mysql_query insert error


FadeOut79

Recommended Posts

Bonjour à tous

 

je dois transferer une bdd dbase vers mysql, donc j'ai décidé de faire un script pour aider la chose (plus de 15000 enregistrement)

 

Le probleme est que la base de donnee dbase n'a pas de standard donc lorsque mon script s'execute environ 0,5% des enregistrement ne sont pas enregistré. Je voudrais donc sans faire un "die" saisir ses numéros d'enregistrement en affichage pour commencer, et par la suite les traiter...

 

Mon probleme est que lorsque j'Essaie d'intercepter le retour des enregistrement fautif, la page ne s'affiche plus...

 

 

voici le code fautif je crois...

 

$resultat = mysql_query("insert into cc_client (NoClient, NoClientA, 
                  Nom, Adresse, Ville, CodePostal, Telephone)  
                  VALUES ($noenreg, '$enrer[0]', '$nom',  
                  '$adresse', '$ville', '$codepostal',  
                  '$notel')",$mydb); 

if (!$resultat) 
{ 
   echo "Une erreur est survenu pour le client " . $enreg[0] . "!"; 
} 

 

Merci d'avance à tous

Link to comment
https://forums.phpfreaks.com/topic/97495-return-on-mysql_query-insert-error/
Share on other sites

Hello to everyone,

 

 

sorry for the french.... now I'll translate  :o

 

I need to transfer a dbase database to mysql with over 15000 records, so I made a script to ease up things a little bit.  The problem is that 0,5% of the records are faulty, so they don't add to the mysql database.  The thing i want to do is to get the Client number of those records to see where is the problem Without using die

 

So i've tryed this code and the page doesn't load anymore

 

(please see last message code ^^^^)

 

Thanx everyone

 

 

If you querys are failing use mysql_error() to retrieve the error from mysql:

$resultat = mysql_query("insert into cc_client (NoClient, NoClientA, 
                  Nom, Adresse, Ville, CodePostal, Telephone)  
                  VALUES ($noenreg, '$enrer[0]', '$nom',  
                  '$adresse', '$ville', '$codepostal',  
                  '$notel')",$mydb) or die('Query error: ' . mysql_error());

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.