#include "mysql.au3"
$objErr = ObjEvent("AutoIt.Error","MyErrFunc")
Dim $var, $sql
$sql = _MySQLConnect("UserName","Password","DB_Name","DB_IP_Address")
$var = _Query($sql,"SELECT user.user_id, user.firstname,user.username,course.code FROM dokeos_main.user ,dokeos_main.course_rel_user, dokeos_main.course where user.user_id=course_rel_user.user_id and course_rel_user.course_code=course.code" )
FileOpen ( "c:\test.txt", 130)
With $var
While NOT .EOF
FileWriteLine("c:\test.txt",.Fields("userna