Chrome console error: POST http://******************** 500 (Internal Server Error)
JS
$.ajax({
method: "POST",
url:"ajax.php",
data: {
x: x,
y: y
},
success:function(data){...}
});
PHP
<?php
date_default_timezone_set('Europe/Madrid');
$link = mysql_connect("*******", "*******", "******");
mysql_select_db("******") or die ("no database");
$name = $_POST['x'];
$score = $_POST['y'];
// Get the current date
$current_date = date('d-m-Y H:i:s');
$sqlCommand = "INSERT INTO hungry_bird (date_played, name, score)
VALUES('$current_date ', '$name', '$score')";
$results = mysql_query($sqlCommand) or die (mysql_error());
mysql_close($link);
?>
Any idea what could be the problem? Thanks.