Web SQL Database.
p170E_SQLDatabase.aia (7.3 KB)
-
We are going to use a SQL database in our web Browser using JavaScript.
-
We don't need to add libraries.
-
We can use the SQL command: https://www.w3schools.com/sql/default.asp
-
We will use Web SQL Database, currently (since 2010) W3C does not support this development, but it works and we can use it without problems.
https://www.w3.org/TR/webdatabase/ -
IndexedDB is more modern and somewhat more complicated to use:
https://javascript.info/indexeddb -
We will use several .htm files with JavaScript, here you can see them:
http://kio4.com/appinventor/170E_DatabaseSQL_JS.htm
Observations:
- Every time you modify an .htm file, restart the MIT Companion to update the changes.
- Beware of single quotes (') and double quotes (")
tx.executeSql('UPDATE usuarios SET name = ' + '"' + name_in + '"' + ', age = "' + age_in + '"' + ' WHERE id =' + id_in + '');
- Designer.
- Blocks.