Author Message

Posted: Mon Apr 28, 2014 10:50 am   Post subject: Help Please - Results to Server (QuizMaker)

Hi all,

If anyone out there is using "Results to Server" and is feeling kind, can I ask for help.

First, I'm no coder, so been trying to make this work but no joy. I'm looking for something simple;

Results sent to MySQL DB and displayed in Spreadsheet fashion via a webpage

If anyone can help either with guidance or file, please reply here or drop me a Private Message or Email.

Many Thanks
Dave


Profile profile test

Posted: Fri Jun 27, 2014 6:38 pm   Post subject: Re: Help Please - Results to Server (QuizMaker)

bump, still in need of help please.


Profile profile test

Posted: Fri Nov 07, 2014 8:12 pm   Post subject: Re: Help Please - Results to Server (QuizMaker)

Dear Dave,
Actually I think we can offer you a Custom Project and develop a code that will receive the data in your system.
This Custom Project Service will not be free of charge.
If you accept a proposal, please contact us at support@ispringsolutions.com


Profile profile test

Posted: Sun Jan 04, 2015 12:04 am   Post subject: Re: Help Please - Results to Server (QuizMaker)

Very late reply but did you read this:

http://www.ispringsolutions.com/article ... erver.html

there is a sample php script linked on that page, you could easily get that modified to post to a database.


Profile profile test

Posted: Sun Jan 04, 2015 12:10 am   Post subject: Re: Help Please - Results to Server (QuizMaker)

Thanks Jeremy, I did.

Trouble is the package advertises as being able to send results to your own Database, which is great for companies that need to keep things in house on Lan.

But if you'd think there would be a simply example of php file that collects the data and a sql example of tables needs to receive that data, with another simple example of a html output page.

That is what I'd guess is a complete basic setup for end users to work with, the page you send me to is not. I'm sure it is okay if your a expert in xml, but I see nothing for saving results to a (example) MySQL database.


Profile profile test

Posted: Sun Jan 04, 2015 12:55 am   Post subject: Re: Help Please - Results to Server (QuizMaker)

Hi Dave,

I am going to do something with this script in the next week or two to try and email quiz results to users.

I will be sticking the results in a database before sending them out.

I can let you have that when its done which may move you a little further forward.

On a side note have you considered using something like Moodle to host your courses?


Profile profile test

Posted: Sun Jan 04, 2015 9:17 am   Post subject: Re: Help Please - Results to Server (QuizMaker)

Hi Jeremy. that would be great many thanks, look forward to viewing.

We did look at Moodle and a few others like Atutor, but for what we needed they all seemed overly complicated both on the user and admin side, when all we needed was access to start learning and send results, which we do currently with webpage links and send to email results.

Ideally I'd like to get webpage holding all learning (Lan site) with results being sent both via email (as backup) and to MySQL DB for displaying on webpage.

Thanks
Dave


Profile profile test

Posted: Wed Feb 04, 2015 6:09 pm   Post subject: Re: Help Please - Results to Server (QuizMaker)

Jeremy, Did you manage to find time and sort anything, did it work ?


Profile profile test

Posted: Wed May 13, 2015 5:11 pm   Post subject: Re: Help Please - Results to Server (QuizMaker)

Hello guys!
We're glad to inform you that we released a new article with detailed instructions and a php script for sending quiz results to server:
http://www.ispringsolutions.com/articles/sending-quiz-results-to-server.html


Profile profile test

Posted: Fri Oct 23, 2015 9:59 pm   Post subject: Re: Help Please - Results to Server (QuizMaker)

Hi there,
Has someone using QuizMaker done a php script to save the results to a mysql file that works?
I have been trying but no luck. Could someone please give me some help (or send a file that works so I can see how it is done)?
My php code is as follow:

Code:
<?php
$servername = "localhost";
$username = "root";
$password = "root";
$dbname = "bdtest";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
   $username = $_POST['USER_NAME'];
        $dateTime = date('Y-m-d_H-i-s');
        $userid = $_POST['USER_ID'];
        $psp =$_POST['psp'];
        $ps= $_POST['ps'];
$sql = "INSERT INTO results (Data, ID, Nome, psp, sp) VALUES ( $dateTime, $userid, $username, $psp, $ps )";

if ($conn->query($sql) === TRUE) {
    echo "New record created successfully";
} else {
    echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?> 


It is quite shorter than the example given by iSpring to ilustrate how to save a txt file....
... but, after a while it just says that it cannot save the results....

Any help or working examples will be greatly appreciated.

Thanks.


Profile profile test

Posted: Mon Oct 26, 2015 10:33 am   Post subject: Re: Help Please - Results to Server (QuizMaker)

Thank you for sharing your script here!

The thing is that we do not have pre-made solutions for MySQL database.
However, I believe out experienced customers can share their own findings here.


Profile profile test

Posted: Mon Nov 02, 2015 5:17 pm   Post subject: Re: Help Please - Results to Server (QuizMaker)

***deleted***


Profile profile test

Posted: Wed Nov 04, 2015 4:15 pm   Post subject: Re: Help Please - Results to Server (QuizMaker)

Hi all,
I managed to get the Php script to save results do MySQL database (following the txt php script from iSpring: for all other development they were asking for a fee (starting at USD 2000).

Since I am a teacher, with no programming skills and no money (not a good combination) I had to teach myself (will tell my students to do the same :-))....

*** The problem ***

SO, what I need was a script to run the flash quiz from a usb pen disk and do two things:
1. Save the results in a Txt file (just copied the script gave as an example by iSpring)
2. Save the Quiz Results to a web server running My SQL

*** My solution ***
(Note: a programmer would have done this, probably, with less code and less time, but since nobody has available to help, I am sharing my scripts, in case someone find them useful. If you can improve it, feel free, and share it back. As I said I am not a computer expert/programmer. I just teach statistics...)

0. So you will need a Apache server with MySQL and PHP running. I am using UwAMP (http://www.uwamp.com/en/) which is quite easy to configure and run from a single USB pen (4 GB). Thus, I have my own single pen webserver, no need to use commercial paid servers.

1. Create the MySQL database and table. I am using this php code:

Code:
<?php
//Create Database
$servername = "localhost";
$username = "root";
$password = "root";

// Create connection
$conn = new mysqli($servername, $username, $password);
 // Check connection
 if ($conn->connect_error) {
     die("Connection failed: " . $conn->connect_error);
}

// Create database
 $sql = "CREATE DATABASE BDtest";
if ($conn->query($sql) === TRUE) {
    echo "Database BDTest created successfully"."<br />";
} else {
    echo "Error creating database: " . $conn->error."<br />";
}

//CreateTable
$dbname = "BDtest";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
 // Check connection
 if ($conn->connect_error) {
     die("Connection failed: " . $conn->connect_error);
}

// sql to create table
$sql = "CREATE TABLE results (
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(30) NOT NULL,
userid VARCHAR(30) NOT NULL,
psp VARCHAR(10),
sp VARCHAR(10),
tp VARCHAR(10),
Respostas VARCHAR(10000),
DateTime TIMESTAMP
)";

if ($conn->query($sql) === TRUE) {
    echo "Table Results created successfully";
} else {
    echo "Error creating table: " . $conn->error;
}


$conn->close();

 ?>


Save this file as "created.php" and run it from your browser

2. Point the Send results to server to http:\\localhost:90\teste\index.php where "teste" is the directory where you have you index.php file (who writes the results to a txt file in a "teste\result" directory and saves the quiz scores to a MySQL Database (use the PhpMyAdmin utility to browse your database). Here is the index.php code:
Code:
<?php
// Make sure that a POST is asked for

    header('Access-Control-Allow-Origin: *');
    if ($_SERVER['REQUEST_METHOD'] != 'POST')
    {
        echo "POST request expected";
        return;
    }
   
 //Errors catching for closed flash file   
    error_reporting(E_ALL && E_WARNING && E_NOTICE);
    ini_set('display_errors', 0);
    ini_set('log_errors', 1);

// include scripts to handle different questions types in iSpring QuizMaker (produced by iSpring team and available in their forum)
    require_once 'includes/common.inc.php';
    $requestParameters = RequestParametersParser::getRequestParameters($_POST, !empty($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : null);
    _log($requestParameters);

//set Database access in you server (mine is localhost)
   $servername = "localhost";
   $user = "root";
   $password = "root";
   $dbname = "bdtest";
   // Create connection
   $conn = new mysqli($servername, $user, $password, $dbname);
   // Check connection (this echos will not work since the flash quiz produced by iSpring does not display regular echo)
    if ($conn->connect_error) {
     die("Connection failed: " . $conn->connect_error);
   }

//Get Results from Quiz POST to server
 try
    {
    //Get Results and parse then
        $quizResults = new QuizResults();
        $quizResults->InitFromRequest($requestParameters);
        $generator = QuizReportFactory::CreateGenerator($quizResults, $requestParameters);
        $report = $generator->createReport();
      $username = $_POST['USER_NAME'];
      $userid = $_POST['USER_ID'];
      $psp =$_POST['psp'];
        $sp= $_POST['sp'];
       $tp= $_POST['tp'];
        $dateTime = date('Y-m-d_H-i-s');
        $detailed_results_xml = $_POST['dr'];
     //write complete results to txt file
        $resultFilename = dirname(__FILE__) . "/result/quiz_result__{$username}_{$userid}_{$dateTime}.txt";
        @file_put_contents($resultFilename, $report);     
      //write selected results to MySQL Database
      $sql = "INSERT INTO results (username, userid, psp, sp, tp, Respostas, DateTime)
      VALUES ('$username','$userid','$psp','$sp','$tp', '$detailed_results_xml', NOW())";
      if ($conn->query($sql) === TRUE) {
       echo "New record created successfully";
      } else {
       echo "Error: " . $sql . "<br>" . $conn->error;
      }
   // if everything went fine, the flash quiz will need to receive this echo "OK". Otherwise it will say "cannot send results to server"...   
       echo "OK";
      }
   
   //Write type of error if something failed in a log file
    catch (Exception $e)
    {
        error_log($e);
        echo "Error: " . $e->getMessage();
    }

    function _log($requestParameters)
    {
        $logFilename = dirname(__FILE__) . '/log/quiz_results.log';
        $event       = array('ts' => date('Y-m-d H:i:s'), 'request_parameters' => $requestParameters, 'ts_' => time());
        $logMessage  = json_encode($event);
        $logMessage .= ',' . PHP_EOL;
        @file_put_contents($logFilename, $logMessage, FILE_APPEND);
    }

$conn->close();
?> 


3. To do: Write the single item results to a column in the database. This could be done generally for whatever quiz, but probably I will just use the questions in my own quiz. Still need to learn how to retrieve the answers from the XML file that iSpring produces and write them to MySQL.

I hope this can be useful to others like me. As I said, I am not a programmer so there is a great chance that this could be done with an easier solution. If you know one, please share!

Best regards,
João Maroco


Profile profile test

Posted: Thu Nov 05, 2015 3:46 pm   Post subject: Re: Help Please - Results to Server (QuizMaker)

Dear João,
Thank you for sharing your script with our customers.
I hope it can be useful for creating a script for sending quiz results to the server and saving them further to MySQL database.
We'll be happy to assist you with the script and try to find the cause of the problem.
But code review isn't included in our free support services.
If you're interested in the Custom Development project, you're welcome to contact our Technical support Team support@ispringsolutions.com


Profile profile test

Posted: Thu Nov 05, 2015 4:25 pm   Post subject: Re: Help Please - Results to Server (QuizMaker)

Julia wrote:

We'll be happy to assist you with the script and try to find the cause of the problem.


Dear Julia,
Thanks for your reply and offer to help.
The posted script works fine!

However, I would like add to it some more features. For example, it would be nice if I could save all the detailed quiz results present into the detailed_results_xml into an automatically created MySQL table.

Again, a skilled php/mysql programmer will probably be able to do it in a few hours. I, on the other hand, still have to learn it from scratch (and still have my regular teaching hours to fullfill).

Now, wouldn't it be great if iSpring programmers could just produce such a script *** save detailed results into MySQL database***?
Teachers like me could run iSpring quizes from local usb servers (not using Moodle or other expensive to install/run LMS) and increase the number of QuizMaker users... it would be a win win situation for everyone.

Think about it, please.

Best,


Profile profile test
Display posts from previous:  Sort by  

   Page: 1, 2, 3, 4, 5


Who is online
Who is online In total there are 6 users online :: 2 registered, 0 hidden and 4 guests (based on users active over the past 5 minutes)
Most users ever online was 108 on Thu Nov 21, 2013 3:41 pm

Registered users: Baidu [Spider], Bing [Bot]