1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

How to update javascript quiz data to database (Netbeans)

Discussion in 'Software Development' started by hehe123, Feb 11, 2018.

Thread Status:
Not open for further replies.
  1. hehe123

    hehe123 Thread Starter

    Joined:
    Feb 1, 2018
    Messages:
    1
    Hi everyone,

    I'm hoping anyone can help me out in this ... so I was tasked to create a quiz in html that would randomise and generate 1o random questions out of 30 questions and I found https://forums.techguy.org/threads/generating-random-questions-in-javascript.446255/ that would perfectly fit my requirements. However, I have trouble trying to update the user's quiz marks into the database based on the user's ID . I've done my research and it seems like I have to work with AJAX in order to do so. I'm very new to AJAX and it would really help if someone can enlighten me in this.
     
  2. oitconz

    oitconz

    Joined:
    Feb 21, 2018
    Messages:
    33
    You need to:
    1: write a page to receive the post in a language that can handle db access. php, asp, java
    2: dont do this if security is an issue. adodb object - see below code 1
    3: Save it to local storage - see https://www.w3schools.com/html/html5_webstorage.asp



    code1:
    var connection = new ActiveXObject("ADODB.Connection") ;

    var connectionstring="Data Source=<server>;Initial Catalog=<catalog>;User ID=<user>;Password=<password>;Provider=SQLOLEDB";

    connection.Open(connectionstring);
    var rs = new ActiveXObject("ADODB.Recordset");

    rs.Open("SELECT * FROM table", connection);
    rs.MoveFirst
    while(!rs.eof)
    {
    document.write(rs.fields(1));
    rs.movenext;
    }

    rs.close;
    connection.close;
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1204739

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice