Web SQL

What is a web sql How do you make a web sql? This script and codes were developed by Tommy on 05 March 2022, Saturday.

How do I make an web sql?
  1. Web SQL Previews
  2. Web SQL HTML Codes
  3. Web SQL JS Codes
Web SQL Previews

Web SQL HTML Codes

<!DOCTYPE html>
<html >
<head>
  <meta charset="UTF-8">
  <title>Web SQL</title>
  
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">

  
  
  <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>

</head>

<body>
    <div>
    <button id="create">Create Table</button>
    <button id="insert">Insert Data</button>
    <button id="load">Load Data</button>
  </div>
  <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>

    <script  src="js/index.js"></script>

</body>
</html>

Web SQL JS Codes

    $(function(){

      var dbName = 'Test1';
      var version = '1.0';
      var displayName = 'Test1';
      var estimatedSize = 65536;

      function createTableIfNotExists(){
        var db = openDB();
        db.transaction(
          function(trans){
            trans.executeSql(
              'CREATE TABLE IF NOT EXISTS list '
              + '( id  INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, '
              + '  name TEXT NOT NULL,'
              + '  email TEXT NOT NULL);'
            );
          }
        );
      }

      function insertData(){
        var db = openDB();
        db.transaction(
          function(trans){
            trans.executeSql(
              'INSERT INTO list (name, email) '
              + 'VALUES ("foo","[email protected]");'
            );
          }
        );
      }

      function getData(){
        var db = openDB();
        db.transaction(
          function(trans){
            trans.executeSql(
              'SELECT * FROM list;',
              [],
              function(trans, r){
                for(var i=0; i<r.rows.length; i++){
                  alert(
                    'id=' + r.rows.item(i).id
                    + ' name: ' + r.rows.item(i).name
                    + ' email: ' + r.rows.item(i).email
                  );
                }
              }
            );
          }
        );
      }

      function openDB(){
        return openDatabase(
          dbName,
          version,
          displayName,
          estimatedSize);
      }

      $('#create').click(function(){
        createTableIfNotExists();
      });

      $('#insert').click(function(){
        insertData();
      });

      $('#load').click(function(){
        getData();
      });
    });
Do you want hide your ip address?Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup.