simkpa Posted September 4, 2012 Share Posted September 4, 2012 (edited) Hi everyone !I try to make a login script by using a Mysql database.I use because he looks easier to use than and the real autoit code.So i do this :expandcollapse popup#include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include "mysql.au3" #include <SQLite.au3> #include <SQLite.dll.au3> Dim $wait #Region ### START Koda GUI section ### Form= Identification $ID_Form = GUICreate("Identification", 259, 123, 192, 124) $NdC_Lbl = GUICtrlCreateLabel("Nom de compte ", 16, 16, 82, 17) $PsWd_Lbl = GUICtrlCreateLabel("Mot de passe", 16, 48, 68, 17) $NdC_Input = GUICtrlCreateInput("", 120, 16, 121, 21) $PsWd_Input = GUICtrlCreateInput("", 120, 48, 121, 21) $Login_Btn = GUICtrlCreateButton("Connexion a la messagerie", 16, 80, 225, 33) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Form= Identification While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Login_Btn $NdC = GUICtrlRead ($NdC_Input) $PsWd = GUICtrlRead ($PsWd_Input) $UserName = "root" $Password = "" $Database = "oom_messagerie" $MySQLServerName = "127.0.0.1" $Mysql_connexion = _MySQLConnect($UserName,$Password,$Database,$MySQLServerName,"{MySQL ODBC 3.51 Driver}",3306) If @error Then _Erreur_1 () EndIf $connexion_requette1 = "select ID from utilisateur where NdC ='"& $NdC &"' AND PsWd ='"& $PsWd &"'" $req = _Query ($Mysql_connexion,$connexion_requette1) If @error Then _Erreur_2 () EndIf While 1 If $req <> 0 Then MsgBox (0,"Victory","Sa marche bro !") ;work test msgbox ExitLoop Else Sleep (1000) $wait = $wait+1 If $wait = 5 Then MsgBox (0,"Fail","Tjr pas dude :/"& @error) ;fail test msgbox ExitLoop EndIf EndIf WEnd _MySQLEnd($Mysql_connexion) EndSwitch WEnd Func _Erreur_1 () MsgBox (61,"OUTCH !","Epic Fail ! erreur de connexion a la database ") EndFunc Func _Erreur_2 () MsgBox (61,"OUTCH !","Epic Fail ! erreur dans la requette de la table") EndFuncI think that my script can connect to the database but i cant get the value of query.I'm in LocalHost ( Xampp ) with ODBC instaled, my database is call oom_messagerie and my table oom_connexion .I work 2 days on it and i really hit my head on the keyboard right now ... I'm not very strong in Autoit and juste begin Mysql so i really need some help Thanks everyone !PS : I'm french ! sorry for the worst english you ever seen !!! Edited September 6, 2012 by simkpa Link to comment Share on other sites More sharing options...
simkpa Posted September 6, 2012 Author Share Posted September 6, 2012 up :/ Link to comment Share on other sites More sharing options...
Colyn1337 Posted September 6, 2012 Share Posted September 6, 2012 Hello!I have to be honest, I've never used the MySQL UDF's... Instead, I use the SQLite UDF's... A while back I posted a script which relies on a database. You can see it here:With luck it might give you some ideas with MySQL or convert you to SQLite.... Or, give you something to do while you wait for someone with MySQL experience Link to comment Share on other sites More sharing options...
simkpa Posted September 6, 2012 Author Share Posted September 6, 2012 Hello ! Thx for your help Colyn1337, a just found how to do it with Mysql Udf, this is the code : With $query_var While Not .EOF $test &= .Fields ("column_name ").value & @CRLF .MoveNext WEnd EndWith You can use the $test var has the seleted part of the Mysql database. Thx everyone ! I hope this can help someone else Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now