Ola
Kinda excited that this is starting to form a shape. This second part of the tutorial deals with reading the users from the MySQL users table and then displaying them in a table.
The first part we just did an intro into what we intend doing and showed how to
1. CREATE a user
2. READ a user (validateuser + checkemail)
all of this using a PHP file sitting on our XAMP server and calling it using CallAjax. I also experimented with CallAjaxWait and realised my error. CallAjaxWait does not return a value. ha ha ha.
To recap, you can visit this link here...https://www.b4x.com/android/forum/threads/banano-mysql-crud-with-php-part-1.104622/
To explain this part, instead of using CallAjax I am using CallAjaxWait. To achieve this, I needed to build my querystring and then pass this to the BANano Ajax call.
First things first
I needed to update the page to have an empty table and also add a button to get all the records...
Then execute the code to get all records from the MySQL db.
Let's take a deeper look here...
Kinda excited that this is starting to form a shape. This second part of the tutorial deals with reading the users from the MySQL users table and then displaying them in a table.
The first part we just did an intro into what we intend doing and showed how to
1. CREATE a user
2. READ a user (validateuser + checkemail)
all of this using a PHP file sitting on our XAMP server and calling it using CallAjax. I also experimented with CallAjaxWait and realised my error. CallAjaxWait does not return a value. ha ha ha.
To recap, you can visit this link here...https://www.b4x.com/android/forum/threads/banano-mysql-crud-with-php-part-1.104622/
To explain this part, instead of using CallAjax I am using CallAjaxWait. To achieve this, I needed to build my querystring and then pass this to the BANano Ajax call.
First things first
I needed to update the page to have an empty table and also add a button to get all the records...
B4X:
banano.GetElement("#body").Append($"<button id="btngetall">GET ALL (WAIT)</button><br><br><br>"$)
banano.GetElement("#body").Append($"<table id="users"></table>"$)
Then execute the code to get all records from the MySQL db.
B4X:
Sub getall(e As BANanoEvent)
If banano.CheckInternetConnectionWait Then
Dim dbAction As Map = CreateMap("action":"getall")
'build the php
Dim m As Map = BuildPHP(dbAction,"users.php")
Dim headers As Map = m.Get("headers")
Dim sCommand As String = m.Get("command")
'execute the php
Dim result As String = banano.CallAjaxWait(sCommand, "GET", "json","",False, headers)
'convert the json string to a list, the list already contains map records for each user
Dim res As List = Json2List(result)
ShowReport(res)
End If
End Sub
Let's take a deeper look here...
Attachments
Last edited: