Hi there
The purpose of this is to demo how one can add, update, read and display mysql database records into a webview.
1. Setting up development environment
For this we have used, Xampp with MySQL, BlueStacks android emulator to install and test our apk, some php with CRUD functions etc.
1.1 B4A & BlueStacks
To be able to use BlueStacks, ensure that after installation, you select the gear, then preferences and Enable Android Debug Bridge (ADB), by default this is turned off. Set up your account and install the B4A bridge.
2. Developing the App
2.1 Setting up XAMP folder for App
With your XAMP installed, create a folder called phplogin under C:\xamp\htdocs\ and copy the users.php file on the files folder there.
NB: The php code HAS TO start with <?php
The username for the php is 'root' and a password has been specified, change this to be your mysql root password and save the file.
2.2 Setting up MySQL database
Fireup phpMyAdmin and ...
1. Create a database called phplogin.
2. Create a table called users
3. Add fields id (int autoincrement), username (text), userpassword (text)
3. The Source Code
3.1 Login
One is able to create a user by specifying the username and userpassword. On login, the username and userpassword are checked against existing records, if existing a msgbox indicates that one can change the screen. If not, a msgbox indicates that the user cannot be validated.
3.2 Register
To register, the username and userpassword are checked against existing records, if the username already exists, the user is told, if not the registration process happens.
3.3 Update Password
To update a userpassword, the username is used. The assumption is that the username should be unique. The new password is saved on the job.tag property and checked against the updated record in the database, if these match, the update went well.
3.4 WebView Report
This process selects all records from the users table, generates an HTML table and this is injected to the webview. All the fields in the users table are shown. As this is just to demo how one can do this, off course one can tweak the code to their needs.
The code is rather simple and straight forward and can be tweaked as per ones needs. This could include using an include file on php for db settings so that the login credentials are not listed on the php file.
The sky is no longer the limit as we have gone to the moon already.
#HelpingOthers2Succeed.
Ta!
The purpose of this is to demo how one can add, update, read and display mysql database records into a webview.
1. Setting up development environment
For this we have used, Xampp with MySQL, BlueStacks android emulator to install and test our apk, some php with CRUD functions etc.
1.1 B4A & BlueStacks
To be able to use BlueStacks, ensure that after installation, you select the gear, then preferences and Enable Android Debug Bridge (ADB), by default this is turned off. Set up your account and install the B4A bridge.
2. Developing the App
2.1 Setting up XAMP folder for App
With your XAMP installed, create a folder called phplogin under C:\xamp\htdocs\ and copy the users.php file on the files folder there.
NB: The php code HAS TO start with <?php
The username for the php is 'root' and a password has been specified, change this to be your mysql root password and save the file.
2.2 Setting up MySQL database
Fireup phpMyAdmin and ...
1. Create a database called phplogin.
2. Create a table called users
3. Add fields id (int autoincrement), username (text), userpassword (text)
3. The Source Code
3.1 Login
One is able to create a user by specifying the username and userpassword. On login, the username and userpassword are checked against existing records, if existing a msgbox indicates that one can change the screen. If not, a msgbox indicates that the user cannot be validated.
3.2 Register
To register, the username and userpassword are checked against existing records, if the username already exists, the user is told, if not the registration process happens.
3.3 Update Password
To update a userpassword, the username is used. The assumption is that the username should be unique. The new password is saved on the job.tag property and checked against the updated record in the database, if these match, the update went well.
3.4 WebView Report
This process selects all records from the users table, generates an HTML table and this is injected to the webview. All the fields in the users table are shown. As this is just to demo how one can do this, off course one can tweak the code to their needs.
The code is rather simple and straight forward and can be tweaked as per ones needs. This could include using an include file on php for db settings so that the login credentials are not listed on the php file.
The sky is no longer the limit as we have gone to the moon already.
#HelpingOthers2Succeed.
Ta!
Attachments
Last edited: