FadeOut79 Posted March 23, 2008 Share Posted March 23, 2008 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 More sharing options...
FadeOut79 Posted March 23, 2008 Author Share Posted March 23, 2008 Hello to everyone, sorry for the french.... now I'll translate 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 Link to comment https://forums.phpfreaks.com/topic/97495-return-on-mysql_query-insert-error/#findComment-498846 Share on other sites More sharing options...
wildteen88 Posted March 23, 2008 Share Posted March 23, 2008 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()); Link to comment https://forums.phpfreaks.com/topic/97495-return-on-mysql_query-insert-error/#findComment-498849 Share on other sites More sharing options...
FadeOut79 Posted March 23, 2008 Author Share Posted March 23, 2008 if i use die, does the page will only write the error and stop process the script??? Link to comment https://forums.phpfreaks.com/topic/97495-return-on-mysql_query-insert-error/#findComment-498850 Share on other sites More sharing options...
wildteen88 Posted March 23, 2008 Share Posted March 23, 2008 It will stop the script completely and only display the mysql error which will help you to debug your query. Link to comment https://forums.phpfreaks.com/topic/97495-return-on-mysql_query-insert-error/#findComment-498851 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.