Android Question executeremotequery sql with for..next

tufanv

Expert
Licensed User
Longtime User
Hello,

ı am using connecting android to mysql database tutorial. I tried a code like this but i am having a problem.:
in a sub i use:

ExecuteRemoteQuery("SELECT * FROM user1 WHERE username='" & txtusername.text & "'", LF1)

then under jobdone / case LF1 I use a for next like this:

B4X:
  Dim addlist9 As List
                    addlist9 = parser.NextArray 'returns a list with maps
                    For i = 0 To addlist9.Size - 1
                    Dim m As Map
                    m = addlist9.Get(i)
                    fromlf= m.Get("sok")
                    tolf=m.Get("sak")
                    ExecuteRemoteQuery("SELECT * FROM userroutes1 WHERE sok='"&tolf&"' and sak'"&fromlf&"' or sok='"&fromlf&"' and sak'"&tolf&"' ", LF2)
                    Next
then the code goes to LF2 under jobdone and it updates the rows with the previous for next

but it only updates the first one. I doubt because i use select again in CASE LF1 section , the first select is not recognized anymore and thats why it only updates the first item only. it doesnt update the next ones.
But i am not sure . Can you tell me what is the reason for this ?
 

tufanv

Expert
Licensed User
Longtime User
yeah i didnt include it in the message it is like this :

B4X:
case LF2
ExecuteRemoteQuery("UPDATE userroutes1 SET lf ='"&ucaklf&"' where id='"&numberofusers&"'", LF3)
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
I guess we can have a better look at it if you include everything
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
ah thank you for answer! I understood the issue. I dont have much php knowledge so it is a big problem for me. Can anyone gie smoe clue about the php script if you have any idea ..
thanks.
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
i have checked the values, it always updates the first of three rows ( in each 3 loops, it always whow the value of first one and thats why it just updates the first one ) it doesnt switch to next altough it should. I ave checked the remote db with phpmyadmin and saw that only 1 of three was updated

This is not correct. You can send multiple requests (you cannot send multiple statements in the same request).

What is the value of LF2?

Add Log(m) to see the actual values that you are sending.
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
or the full loop source as requested yesterday that we atleast get an idea what you are doing (wrong).
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
The problem is it doesnt wait for executermotequery to be done, it passes to next loop before completeing the execureremoteqery
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
I have added the jobs as strings to list and i use executeremotequery(list1.get(0),jobname)) is it right ? or if not how can i add the jobs to list =

It shouldn't stop. It is executed in the background. If you want to send the jobs one after another then you can add the jobs to a List, send the first one and then in JobDone send the next one each time.
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
i am using only one job everytime. I have jobdone sub. Under it I use case xxx, case yyy for possible outcomes. I am executing different queries with this job. when i execute this queries with for next it makes the problem
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…