JerichoDummyLearner
Member
Hi! I'm an absolute newbie here, I need help in validating my database using MySQL.
here's my query
sql.validate=SELECT * FROM `tbl_userinfo` WHERE `Username` = '" & uName.Text & "' AND `Password`='" & pWord.Text & "'
In here, I have two edit texts, uName and pWord.
It works just fine when I assign custom values to the username and passwords (which exists in MySql table I made). I.E,
sql.validate=SELECT * FROM `tbl_userinfo` WHERE `Username` = "John" AND `Password`="123"
However it doesn't seem to work when I assign edittext variables.
here's my sub
Sub Button2_Click
Dim LoginStatus As Int
LoginStatus = 0
Dim req As DBRequestManager = CreateRequest
Dim cmd As DBCommand = CreateCommand("validate", Null)
Wait For (req.ExecuteQuery(cmd, 0, Null)) JobDone(j As HttpJob)
If j.Success Then
req.HandleJobAsync(j, "req")
Wait For (req) req_Result(res As DBResult)
'work with result
req.PrintTable(res)
If res.Rows.size > 0 Then
LoginStatus = 1
MsgboxAsync("Valid user ", "Login successful")
StartActivity("Home")
Else
LoginStatus=0
MsgboxAsync("Invalid user ","Login Unsuccessful")
End If
Else
Log("ERROR: " & j.ErrorMessage)
End If
j.Release
Note: I've already established connection using jRDC2
I also used a b4a member named anser's code as reference
here's my query
sql.validate=SELECT * FROM `tbl_userinfo` WHERE `Username` = '" & uName.Text & "' AND `Password`='" & pWord.Text & "'
In here, I have two edit texts, uName and pWord.
It works just fine when I assign custom values to the username and passwords (which exists in MySql table I made). I.E,
sql.validate=SELECT * FROM `tbl_userinfo` WHERE `Username` = "John" AND `Password`="123"
However it doesn't seem to work when I assign edittext variables.
here's my sub
Sub Button2_Click
Dim LoginStatus As Int
LoginStatus = 0
Dim req As DBRequestManager = CreateRequest
Dim cmd As DBCommand = CreateCommand("validate", Null)
Wait For (req.ExecuteQuery(cmd, 0, Null)) JobDone(j As HttpJob)
If j.Success Then
req.HandleJobAsync(j, "req")
Wait For (req) req_Result(res As DBResult)
'work with result
req.PrintTable(res)
If res.Rows.size > 0 Then
LoginStatus = 1
MsgboxAsync("Valid user ", "Login successful")
StartActivity("Home")
Else
LoginStatus=0
MsgboxAsync("Invalid user ","Login Unsuccessful")
End If
Else
Log("ERROR: " & j.ErrorMessage)
End If
j.Release
Note: I've already established connection using jRDC2
I also used a b4a member named anser's code as reference