Zedna Posted June 10, 2011 Posted June 10, 2011 $fields = _MySQL_Num_Fields($res) $rows = _MySQL_Num_Rows($res) Dim $array[$rows][$fields] What are values of $rows and $fields? Is it zero? Resources UDF ResourcesEx UDF AutoIt Forum Search
mircea Posted June 10, 2011 Author Posted June 10, 2011 Yes, cause it can't find that username so it gives null or zero
mircea Posted June 11, 2011 Author Posted June 11, 2011 Ok i fix that with a condition If $row = 0 then the username is wrong and if else the username can log in. But what about the critical error ? and the aplication exists?
mircea Posted June 12, 2011 Author Posted June 12, 2011 Can someone help me with the critical error message and why the aplication exit?
Zedna Posted June 12, 2011 Posted June 12, 2011 Can someone help me with the critical error message and why the aplication exit? As I said it can't be zero for such array declaration. So make it like this if $rows = 0 Or $cols = 0 then show some error ... else Dim $my_array[$rows][$cols] end if Resources UDF ResourcesEx UDF AutoIt Forum Search
mircea Posted June 12, 2011 Author Posted June 12, 2011 (edited) 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 expandcollapse popupcase $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 expandcollapse popupcase $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 June 12, 2011 by mircea
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