Jump to content

Mysql help


Recommended Posts

Yes i fix that error, but now it gives me a critical error when i try to make a new account. It give's me the mysql error that it say it's primary and you can't have 2 usernames the same, i click ok and the aplication give's me a critical error and exit

Edit:

I found out the cause of the problem: the problem was because of the command exitloop (to be onest i don't know why it give's the error but now it's working.

Now

case $createnewuser
                                    if ControlGetText("","",$newuserinput) = "" or ControlGetText("","",$newpassinput) = "" then 
                                        msgbox(0,"Error", "Username/Password can't be blank")
                                    Else 
                                        _MySQL_InitLibrary()
                                            If @error Then Exit MsgBox(0, 'Error', "Lipsa fisier libmysql.dll")
                                        

                                            $MysqlConn = _MySQL_Init()
    
                                            $connected = _MySQL_Real_Connect($MysqlConn,$mysqladress,$mysqlusername,$mysqlpassword,$mysqldatabase)

                                            If $connected = 0 Then
                                            $errno = _MySQL_errno($MysqlConn)
                                            MsgBox(0,"Error:",$errno & @LF & _MySQL_error($MysqlConn))
                                            If $errno = $CR_UNKNOWN_HOST Then MsgBox(0,"Error:","$CR_UNKNOWN_HOST" & @LF & $CR_UNKNOWN_HOST)
                                            Endif
                                            
                                            
                                            $query2 = "INSERT INTO Accounts (nume_user,Parola,Creat_de,data,ora) values ('"& Guictrlread($newuserinput) &"','"& _StringEncrypt(1,Guictrlread($newpassinput),$criptarekey,$passlevel)&"','"&guictrlread($Loginput)&"','"& @MDAY & "-"& @MON &"-"& @YEAR &"','"& @hour&":"& @MIN & ":" & @SEC&"')"

                                            $mysql_bool = _MySQL_Real_Query($MysqlConn, $query2)
                                            If $mysql_bool = $MYSQL_SUCCESS Then
                                            
                                            MsgBox(0,"Succes", "Username succesffuly created",2)
                                            Exitloop

                                            Else
                                                msgbox(0,"Error","Error: That username allready exists",2)
                                                
                                            EndIf
                                            
                                            
                                            

                                            
                                            
                                            _MySQL_Free_Result($mysql_bool)
                                            _MySQL_Close($MysqlConn)
                                            _MySQL_EndLibrary()
                                            
                                            
                                    Endif

before

case $createnewuser
                                    if ControlGetText("","",$newuserinput) = "" or ControlGetText("","",$newpassinput) = "" then 
                                        msgbox(0,"Error", "Username/Password can't be blank")
                                    Else 
                                        _MySQL_InitLibrary()
                                            If @error Then Exit MsgBox(0, 'Error', "Lipsa fisier libmysql.dll")
                                        

                                            $MysqlConn = _MySQL_Init()
    
                                            $connected = _MySQL_Real_Connect($MysqlConn,$mysqladress,$mysqlusername,$mysqlpassword,$mysqldatabase)

                                            If $connected = 0 Then
                                            $errno = _MySQL_errno($MysqlConn)
                                            MsgBox(0,"Error:",$errno & @LF & _MySQL_error($MysqlConn))
                                            If $errno = $CR_UNKNOWN_HOST Then MsgBox(0,"Error:","$CR_UNKNOWN_HOST" & @LF & $CR_UNKNOWN_HOST)
                                            Endif
                                            
                                            
                                            $query2 = "INSERT INTO Accounts (nume_user,Parola,Creat_de,data,ora) values ('"& Guictrlread($newuserinput) &"','"& _StringEncrypt(1,Guictrlread($newpassinput),$criptarekey,$passlevel)&"','"&guictrlread($Loginput)&"','"& @MDAY & "-"& @MON &"-"& @YEAR &"','"& @hour&":"& @MIN & ":" & @SEC&"')"

                                            $mysql_bool = _MySQL_Real_Query($MysqlConn, $query2)
                                            If $mysql_bool = $MYSQL_SUCCESS Then
                                            
                                            MsgBox(0,"Succes", "Username succesffuly created",3)

                                            Else
                                                msgbox(0,"Error","Error: That username allready exists")
                                            EndIf
                                            
                                            
                                            

                                            
                                            
                                            _MySQL_Free_Result($mysql_bool)
                                            _MySQL_Close($MysqlConn)
                                            _MySQL_EndLibrary()
                                            
                                            Exitloop
                                    Endif
Edited by mircea
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...