Hi All,
I need help to write a query in B4A to validate login. I mean if the username=user1and password =123 then the msgbox("welcome") if not match the msgbox("incorrect username/password).
B4A Code:
Sub ExecuteRemoteQuery(Query As String, JobName As String)
Dim job As HttpJob
job.Initialize(JobName, Me)
job.PostString("http://khalidvb.com/androidconn/login.php",Query)
End Sub
Sub btn_login_Click
ExecuteRemoteQuery("SELECT * FROM users_master_table where username='" & txt_username.text &"' and password='" & txt_pwd.text & "'", uservalue)
End Sub
Sub JobDone(Job As HttpJob)
ProgressDialogHide
If Job.Success Then
Dim res As String
res = Job.GetString
Log("Response from server: " & res)
Dim parser As JSONParser
parser.Initialize(res)
Select Job.JobName
Case uservalue
' login validation
End Select
Else
ToastMessageShow("Error: " & Job.ErrorMessage, True)
End If
Job.Release
End Sub
I need help to write a query in B4A to validate login. I mean if the username=user1and password =123 then the msgbox("welcome") if not match the msgbox("incorrect username/password).
B4A Code:
Sub ExecuteRemoteQuery(Query As String, JobName As String)
Dim job As HttpJob
job.Initialize(JobName, Me)
job.PostString("http://khalidvb.com/androidconn/login.php",Query)
End Sub
Sub btn_login_Click
ExecuteRemoteQuery("SELECT * FROM users_master_table where username='" & txt_username.text &"' and password='" & txt_pwd.text & "'", uservalue)
End Sub
Sub JobDone(Job As HttpJob)
ProgressDialogHide
If Job.Success Then
Dim res As String
res = Job.GetString
Log("Response from server: " & res)
Dim parser As JSONParser
parser.Initialize(res)
Select Job.JobName
Case uservalue
' login validation
End Select
Else
ToastMessageShow("Error: " & Job.ErrorMessage, True)
End If
Job.Release
End Sub