Last active
September 3, 2019 23:54
-
-
Save topherPedersen/7b5f9784cc9441c95d1a6af1700b1446 to your computer and use it in GitHub Desktop.
Leaderboard Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$playerName = $_POST['playerName']; | |
$score = $_POST["score"]; | |
$servername = "localhost"; | |
$username = "shranos_admin"; | |
$password = "letsgo"; | |
$dbname = "shranos_db"; | |
// Create connection | |
$conn = new mysqli($servername,$username,$password,$dbname); | |
// Check connection | |
if ($conn->connect_error) { | |
die("Connection failed: ".$conn->connect_error); | |
} | |
// $sql = "INSERT INTO leaderboard_table (username_column, highscore_column) VALUES ('aNub', 0)"; | |
$sql = "INSERT INTO leaderboard_table (username_column, highscore_column) VALUES ('" . $playerName . "', " . $score . ")"; | |
if ($conn->query($sql)===TRUE) { | |
// echo "New record created successfully"; | |
echo "your moms score added to leaderboard, thx noob"; | |
} else { | |
// echo "Error: ".$sql."<br>".$conn_error; | |
echo "ERROR: PC LOAD LETTER"; | |
} | |
$conn->close(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment