Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This script will help you:</p> <pre><code>&lt;script type="text/javascript"&gt; function createDatabase(){ try{ if(window.openDatabase){ var shortName = 'db_xyz'; var version = '1.0'; var displayName = 'Display Information'; var maxSize = 65536; // in bytes db = openDatabase(shortName, version, displayName, maxSize); } }catch(e){ alert(e); } } function executeQuery($query,callback){ try{ if(window.openDatabase){ db.transaction( function(tx){ tx.executeSql($query,[],function(tx,result){ if(typeof(callback) == "function"){ callback(result); }else{ if(callback != undefined){ eval(callback+"(result)"); } } },function(tx,error){}); }); return rslt; } }catch(e){} } function createTable(){ var sql = 'drop table image'; executeQuery(sql); var sqlC = 'CREATE TABLE image (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, image BLOB )'; executeQuery(sqlC); } function insertValue(){ var img = document.getElementById('image'); var sql = 'insert into image (name,image) VALUES ("sujeet","'+img+'")'; executeQuery(sql,function(results){alert(results)}); } &lt;input type="button" name='create' onClick="createDatabase()" value='Create Database'&gt; &lt;input type="button" name='create' onClick="createTable()" value='create table'&gt; &lt;input type="button" name='insert' onClick="insertValue()" value='Insert value'&gt; &lt;input type="button" name='select' onClick="showTable()" value='show table'&gt; &lt;input type="file" id="image" &gt; &lt;div result&gt;&lt;/div&gt; &lt;/script&gt; </code></pre> <p>To download the code go visit url:</p> <p><a href="http://blog.developeronhire.com/create-sqlite-table-insert-into-sqlite-table/">http://blog.developeronhire.com/create-sqlite-table-insert-into-sqlite-table/</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload