Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7830729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:23:06+00:00 2026-06-02T11:23:06+00:00

I’m developping a button with css and i used SQLite and jquery to build

  • 0

I’m developping a button with css and i used SQLite and jquery to build the OnClick event but the query didn’t work .After clicking the button with id =”gameLogin” i want to insert the value of the input field firstName in the table Contacts . After running the database and the table are created ,

any idea please? is There another solution ?

Thank you much

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"                                 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml">
            <head>
                <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
                <title>SQL Storage</title>
                <script src="http://code.jquery.com/jquery-latest.js"></script>
                <link rel="stylesheet" href="css/main.css" />
            </head>

            <body>    
                <br/><br/>
                <div align="center">
                    <section id="gameIntro">
                        First name:<input type="text" id="firstName"/><br/>
                        <p><a id="gameLogin"   class="button3 blue medium"  href="game.html">Login</a> 
                        </p>
                    </section>
                </div>
            </body>

            <script> 
                var results = document.getElementById('results'); 
                //var id = document.getElementById('id');
                var firstName = document.getElementById('firstName');  
                var createStatement = "CREATE TABLE IF NOT EXISTS Contacts (firstName TEXT PRIMARY KEY )";
                var selectAllStatement = "SELECT * FROM Contacts";
                var insertStatement = "INSERT INTO Contacts (firstName) VALUES (?)";
                var updateStatement = "UPDATE Contacts SET firstName = ?, WHERE firstName = ?";
                var deleteStatement = "DELETE FROM Contacts WHERE firstName=?";
                var dropStatement = "DROP TABLE Contacts";
                var findStatement = "SELECT * FROM Contacts WHERE firstName=?";
                var db = openDatabase("AddressBook", "1.0", "Address Book", 200000);
                var dataset;
                createTable();

                $("#gameLogin").click( function(){
                    db.transaction( function(tx) {tx.executeSql(insertStatement,[firstName.value],onErrorLogIn,goplay); });
                });

              ..........     .........
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T11:23:09+00:00Added an answer on June 2, 2026 at 11:23 am

    Also, with the jQuery library, things like document.getElementById are completely unnecessary. It’s very obvious from the look of your code that you have a "grand idea" you wish to achieve, but you really need to read some documentation on how to use jQuery, and on how to make proper SQL calls with MVC.

    I’m going through the trouble of making a suggested reading list, I strongly recommend you check ALL of these links out.

    • W3 Schools JS (not the best guide, but if you can’t pass the test they have for JS you’re not quite ready for libraries)

    • jQuery Documentation

    • jQueryUI Documentation

    • Free PHP tutorials (this is the language to best make SQL calls from because it keeps the call "server" side which helps prevent hacking)

    • Codeigniter (A Great Opensource PHP Library)

    • Beginner Guide to MVC with Codeigniter (How to make a login, basically)

    • SQL Injection Wiki also See This (Will tell you why what you’re doing is so bad, or should at least give you a clue)

      And finally, if you’re making an online game with js, I would suggest the following jQuery Plugin

    • GameQuery

    And if you still insist on using SQL in javascript, read this

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.