i have a little problem with my program.
The answer advises me to check the correct syntax up to my mysql version, but i caught the result and try to inject it with another soft (sequel) and the request is correct ! So i think i mistake with Livecode syntax.
Here my code :
Code: Select all
on mouseUp
   local timport, tPasse
   global gConnectionID
   lock screen
   -- Les champs sont délimités par un point-virgule
   set itemDel to ";"
   
   --Sélection du fichier d'importation des profs
   answer file " Sélectionner le fichier :"
         if the result is not "cancel" then
            put URL("file:" & it) into timport
            put empty into tSQL
            replace "'" with "" in timport
            replace "ç" with "c" in timport
            put 1 into tPasse
            repeat for each line tline in timport
               put toUpper(item 1 of tline) into tNom
               put toUpper(item 2 of tline) into tPrenom
               put toUpper(item 6 of tline) into tClassePP
               put item 3 of tline into tLogin
               put toUpper(item 4 of tline) into tMdp
               put toUpper(item 5 of tline) into tMatiere
                  --if tPasse >1 then
                  put "INSERT INTO profs(ID, nom_prof, prenom_prof, login_prof, passe_prof, matiere_prof, pp_classe)" & \
                        " VALUES(NULL,'"&tNom&"', '"&tPrenom&"', '"&tLogin&"','"&tMdp&"', '"&tMatiere&"', '"&tClassePP&"');" & cr after tSQL
                  --else
                        --put "INSERT INTO profs(ID, nom_prof, prenom_prof, login_prof, passe_prof, matiere_prof, pp_classe)" & \
                        --" VALUES(NULL,'"&tNom&"', '"&tPrenom&"', '"&tLogin&"','"&tMdp&"', '"&tMatiere&"', '"&tClassePP&"');" & cr into tSQL
                        put 2 into tPasse
                        --end if
                     end repeat
                  end if
                  
                  --On éxécute la requête
                  put tSQL
                  revExecuteSQL gConnectionID , tSQL
Here the request :
Code: Select all
INSERT INTO profs(ID, nom_prof, prenom_prof, login_prof, passe_prof, matiere_prof, pp_classe) VALUES(NULL,'TOUI', 'PATRIC', 'touip','xxxxxxx', 'FRANCAIS', '');
INSERT INTO profs(ID, nom_prof, prenom_prof, login_prof, passe_prof, matiere_prof, pp_classe) VALUES(NULL,'PICHETI', 'JENICHEL', 'pichetj','xxyxxyx', 'ATELIER', '4A');
...(etc)
 .
.Thanks.


