Attached code:
12345678910111213141516
<script type="text/javascript">
// Make connection
db = new localsql( window.localStorage, 'myDB');
// Create table, only needs to be done once per user
// it will be saved in the localStorage so if user refreshes
// the data will still be there.
db.query('CREATE TABLE users(id AUTOINCREMENT, username STRING, firstname STRING, lastname STRING, email STRING, phone INT)');
// Insert our first user
db.query('INSERT INTO users(username, firstname, lastname, email, phone) VALUES("JohnD", "John", "Doe", "John@example.com", "1234567890")');
// Select everything out of the users table
db.query('SELECT * FROM users');
// Fetches the row
console.log(db.fetchrows());
</script>
// Make connection
db = new localsql( window.localStorage, 'myDB');
// Create table, only needs to be done once per user
// it will be saved in the localStorage so if user refreshes
// the data will still be there.
db.query('CREATE TABLE users(id AUTOINCREMENT, username STRING, firstname STRING, lastname STRING, email STRING, phone INT)');
// Insert our first user
db.query('INSERT INTO users(username, firstname, lastname, email, phone) VALUES("JohnD", "John", "Doe", "John@example.com", "1234567890")');
// Select everything out of the users table
db.query('SELECT * FROM users');
// Fetches the row
console.log(db.fetchrows());
</script>