Review/Rate Course and Post Results to a Database, not via Google Sheets

Using the advice and guidance from this forum, I developed a review/rating slide that will go at the end of our courses and before the user gets their results.  The slide automatically posts the results to a Google Sheet, populating it with username data (javascript pulling data from the LMS, in my case Moodle), static data (course name etc stored in variables) and the data input during the review/rating.

Brilliant....it works, but not good enough!

Many clients will block Google Sheets, so I need to know how to post the same data to an SQL database on the same server as my Moodle.

You can try out the slide here:

http://governancepeople.com/course_review/story.html

Any help much appreciated......

 

Les

3 Replies
Nalin Dwivedi

I apologize for the late response.

For achieving this, you can use an intermediate PHP file to send and retrieve data from SQL server. 

So the flow will necessary look like

Articulate Storyline Javascript --> PHP --> SQL and vice versa

If you need the code for doing this, I can post it after configuring some details.

Nalin Dwivedi

Here's the PHP file code for registration of a player:

_____________________________PHP File Code__________________________________________

<?php
$serverName = "server_name,port_name";
// The connection will be attempted using Windows Authentication.

$connectionInfo = array(
"Database" => "database_name",
"UID" => "database_UID",
"PWD" => "database_password"
);

//Establish Connection Using Above Specified Details
$conn = sqlsrv_connect( $serverName, $connectionInfo);


//Escape user inputs for security
$empid = $_GET['empid'];
$name = $_GET['name'];
$batch = $_GET['batch'];
$location = $_GET['location'];
$country = $_GET['country'];
$password = $_GET['password'];


$sql = "insert into SCHEMA.TABLE1(emp_id, name, batch_id, process, location, country, reg_time, password) VALUES ('$empid', '$name', '$batch', '$location', '$country', Current_Timestamp, '$password')";

$stmt = sqlsrv_query( $conn, $sql);

//Check if query is executed properly
if( $stmt === false) {
die( print_r( sqlsrv_errors(), true) );
}


$rows_affected = sqlsrv_rows_affected( $stmt);

echo $rows_affected;


?>

_________________________________PHP File code ends___________________________________

 

You can easily find the javascript code online for sending the required data from javascript to PHP.

I hope it helps.