mardi 21 juin 2016

Display random values From Sqlite Database Using JavaScript

I'm using Cordova Database and I have to display my images in the database randomly. Sqlite order by Random() is not working ... Here is my code

Var myDB = window.openDatabase("Database", "1.0", "Cordova Demo",10485760);
myDB.transaction(function(transaction) {

    transaction.executeSql('SELECT * FROM YOUTUBE_VIDEOO ORDER BY RANDOM LIMIT 6 ', [], function(tx, res){
        for(var iii = 0; iii < res.rows.length; iii++)
        {
            $('#uTubeLst').append("<div style='float:left;padding:10px;'><img src ='data:image/png;base64,"+res.rows.item(iii).imgSRc+"' width=40 height=50  ></div>");
        }

        function(transaction){

            var $lastNo = "";
        }
    }, null);
});




Aucun commentaire:

Enregistrer un commentaire