I always must call twice ExecuteRemoteQuery, because at first attempt ' ResponseSuccess ' returns nothing, at the second attempt it always correctly returns the data stored in sql database.
Am I wrong in my basic 4 android code ?
I'am thinking about a problem in the server (PHP 5 or MYSQL) too.
Can someone help me ? please.
Thank you.
Am I wrong in my basic 4 android code ?
I'am thinking about a problem in the server (PHP 5 or MYSQL) too.
Can someone help me ? please.
Thank you.
webwrite = 1
webread = 2
ExecuteRemoteQuery("comando=leggitutto", webread)
Sub ExecuteRemoteQuery(Query As String, TaskId As Int)
Dim req As HttpRequest
req.initializeGet ("http://XXXXXXXXXX.it/codice.php?user=YYYYYYYY&password=ZZZZZZZZZZZ&" & Query )
hc.Execute(req, TaskId)
End Sub
Sub hc_ResponseError (Response As HttpResponse, Reason As String, StatusCode As Int, TaskId As Int)
Log("Error: " & Reason & ", StatusCode: " & StatusCode)
If Response <> Null Then
Log(Response.GetString("UTF8"))
Response.Release
End If
ProgressDialogHide
End Sub
Sub hc_ResponseSuccess (Response As HttpResponse, TaskId As Int)
Dim res As String
res = Response.GetString("UTF8")
webfields=0
Log("Response from server: " & res)
Dim parser As JSONParser
parser.Initialize(res)
Select TaskId
Case 2 'webread
Dim countries As List
countries = parser.NextArray 'returns a list with maps
webfields=countries.Size
For i = 0 To countries.Size - 1
Dim m As Map
m = countries.Get(i)
wdb(i).cat=m.get("alfa")
wdb(i).subcat=m.get("beta")
wdb(i).user=m.get("gamma")
......
......
Next
End Select
ProgressDialogHide
response.Release
End Sub