I have a high scores table for a game hosted on this webhost. I'm using PHP with sqlite pdo extensions to have access to the database. I can't seem to figure out what is happening to the database, as the query is not being inserted into the database. I know that the database is working and can be read from as I can get results out of the database. I get no output on the webpage saying something is wrong.
Additionally, I've tried a couple of differint methods of sending the query like with $dbConn->query("Select * from something;");
.
include_once("Includes/connectDB.php");
$level = $_POST['level'];
$name = $_POST['name'];
$score = $_POST['score'];
$salvage = $_POST['salvage'];
$asteroids = $_POST['asteroids'];
$diff = $_POST['diff'];
if(($level > 0) and ($level <= 5))
{
// make sure table exists
$tbName = getHiS_Tb_Name($level);
// insert data
$sql = "Insert into $tbName (NAME, SCORE, SALVAGE_COLLECTED, ASTEROIDS_DESTROYED, DIFFICULTY)
Values(:name , :score, :salvage, :asteroids, :diff);";
try{
$stmt = $dbConn->prepare($sql);
$stmt->bindParam(':name', $name);
$stmt->bindParam(':score', $score);
$stmt->bindParam(':salvage', $salvage);
$stmt->bindParam(':asteroids', $asteroids);
$stmt->bindParam(':diff', $diff);
$stmt->execute();
}catch(PDOException $e){
echo $e->getMessage();
}
}