· 9 years ago · Sep 17, 2016, 02:36 AM
1<?php
2
3$secretKey = "micomadhi"; // Change this value to match the value stored in the client javascript below
4
5 try {
6 $dbh = new PDO('mysql:host='. $hostname .';dbname='. $database, $username, $password);
7 } catch(PDOException $e) {
8 echo '<h1>An error has ocurred.</h1><pre>', $e->getMessage() ,'</pre>';
9 }
10
11
12 $sth = $dbh->prepare("INSERT INTO scores VALUES (null, :name, :score)");
13
14 try {
15 $sth->execute($_GET);
16 } catch(Exception $e) {
17 echo '<h1>An error has ocurred.</h1><pre>', $e->getMessage() ,'</pre>';
18 }