Hi all !
I need something to read student's name and birth date in their "results .txt", then fetch their new classroom from a database an finally move their results .txt in the classroom's folder.
Maybe a little complicated for one of my first script ...
here is what I have actually:
#include "FileListToArrayEx.au3"
#include "array.au3"
#include "mysql.au3"
While 1
$results = _FileListToArrayEx(@ScriptDir,'*.txt',1,'',True)
If NOT @error Then
For $i = 1 to $results[0]
$sql = _MySQLConnect("root","","tbds","localhost")
$f = FileOpen( $results[$i], 0 )
$nom_f = FileReadLine( $f , 2 )
$naiss_f = FileReadLine( $f , 3 )
;MsgBox(0,"",$nom_f & $naiss_f)
$division = _Query($sql,"SELECT division FROM eleves WHERE nom = " & $nom_f & " AND naiss = " & $naiss_f )
FileClose($f)
_MySQLEnd($sql)
FileMove(@ScriptDir & "\" & $results[$i], "C:\" & $division, 8)
Next
EndIf
WEnd
all results .txt are in the script dir and look like:
the csv I made the tbds DB table from:
no error message but the script doesn' work... what am I doing wrong??
Thanks!