خرید بک لینک

Vote count: 0

I am working on a phonegap app, and have so far set-up the database to which I have the insert and delete function's working correctly.

I am now struggling on checking input values with the data in the database, so for example for now I am just simply attempting to check if any rows are retued, and if there is that will mean the user and pass entered are in the database, if no rows are retued then the user and pass is false.

I am not getting any errors from the sql statement (function errorCB), as well I did put an debug alert within the function LoginSuccess and that worked, however after removing the debug alert in the LoginSuccess function, I do not get prompted with any alerts and instead the page just refreshes.

I have removed the delete and insert functions from the code as it's relevant to this issue.

Any help will be much appreciated.

document.addEventListener("deviceready", onDeviceReady, false);

           var db;

             function onDeviceReady() {
              db = window.openDatabase("DBkhan", "1.0", "SFDatabase", 2*1024*1024);
                         db.transaction(createDB, errorCB, successCB);

                     }

            function createDB(tx) {
   tx.executeSql('CREATE TABLE IF NOT EXISTS mahdi (FirstName text, LastName text, Email text, Password text)');

                     }

                     function errorCB(err) {
                         alert("Error processing SQL: "+err.code);
                     }

                     function successCB() {
                  alert("Database Ready");
                     }

 function loginUser()
         {
        db = window.openDatabase("DBkhan", "1.0", "SFDatabase", 2*1024*1024);
        db.transaction(loginDB, errorCB, LoginSuccess);
        }

        function loginDB(tx)
        {
           var Useame = document.getElementById("useame").value;
         var Password = document.getElementById("password").value;
         tx.executeSql("SELECT * FROM mahdi WHERE FirstName='" + Useame + "' AND Password= '" + Password + "'");

         } function LoginSuccess(tx, results) {
           if (results.rows.length > 0) {
           alert ("User and Pass Found");
           }
           else
           {
           alert ("User and Pass incorrect");
           }

}

asked 7 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 17 اسفند 1394 ساعت: 22:16

صفحه بندی