A apty Active Member Licensed User Longtime User Aug 26, 2018 #1 I am connecting to an online mysql db using B4A job. My table has questions and i would like to move from one question to the next using previous/next buttons. What i have done so far is to add the id of the questions to a list. I then use an index and set it to Code: Copy CurrentIndex = questionslist.Size my questionslist.size returns the correct number of questions from the table How can i use it to get the exact question and post it on current page, then when i click next, it moves to the next question?
I am connecting to an online mysql db using B4A job. My table has questions and i would like to move from one question to the next using previous/next buttons. What i have done so far is to add the id of the questions to a list. I then use an index and set it to Code: Copy CurrentIndex = questionslist.Size my questionslist.size returns the correct number of questions from the table How can i use it to get the exact question and post it on current page, then when i click next, it moves to the next question?
Erel B4X founder Staff member Licensed User Longtime User Aug 26, 2018 #2 apty said: I am connecting to an online mysql db using B4A job Click to expand... Are you using jRDC2? What is the content of questionslist? Upvote 0
apty said: I am connecting to an online mysql db using B4A job Click to expand... Are you using jRDC2? What is the content of questionslist?
A apty Active Member Licensed User Longtime User Aug 26, 2018 #3 i am connecting as below: Code: Copy Sub selectquestions ExecuteSelectQuery("select question,id from questions",Q_SELECT) End Sub Sub ExecuteSelectQuery(Query As String, JobName As String) Dim job2 As HttpJob job2.Initialize("job2", Me) job2.PostString(url, Query) End Sub I then use the below code in JobDone Code: Copy questionslist.Add(m.Get("id")) The questionslist contains ids of the questions. Upvote 0
i am connecting as below: Code: Copy Sub selectquestions ExecuteSelectQuery("select question,id from questions",Q_SELECT) End Sub Sub ExecuteSelectQuery(Query As String, JobName As String) Dim job2 As HttpJob job2.Initialize("job2", Me) job2.PostString(url, Query) End Sub I then use the below code in JobDone Code: Copy questionslist.Add(m.Get("id")) The questionslist contains ids of the questions.
Erel B4X founder Staff member Licensed User Longtime User Aug 26, 2018 #4 You are using the old and not recommended PHP web service. Switch to jRDC2 if you can. You can create a custom type that holds all the information you need to for each question and fill the list with these custom types. See the objects & custom types tutorial: https://www.b4x.com/etp.html Upvote 0
You are using the old and not recommended PHP web service. Switch to jRDC2 if you can. You can create a custom type that holds all the information you need to for each question and fill the list with these custom types. See the objects & custom types tutorial: https://www.b4x.com/etp.html
A apty Active Member Licensed User Longtime User Aug 26, 2018 #5 Thanks. The problem i am having is how to move to next and previous pages showing next and previous questions. For example if my list has the following Code: Copy [{"question":"test question"},{"question":"test question2"},{"question":"test question3"}] and i have a layout with a label and two buttons (previous and next buttons). How can i show the question on the label and move to next question on clicking next button? Upvote 0
Thanks. The problem i am having is how to move to next and previous pages showing next and previous questions. For example if my list has the following Code: Copy [{"question":"test question"},{"question":"test question2"},{"question":"test question3"}] and i have a layout with a label and two buttons (previous and next buttons). How can i show the question on the label and move to next question on clicking next button?
Erel B4X founder Staff member Licensed User Longtime User Aug 27, 2018 #6 You need to parse this string. This tool will help you: https://b4x.com:51041/json/index.html Upvote 0