<?php
$route = $_POST["select-route"];
$currentStop = $_POST["current-bus-stop"];
date_default_timezone_set("Asia/Kolkata");
$currentTime = date("h:i A");
$host = "localhost";
$dbname = "findmybus-test";
$username = "root";
$password = "";
$conn = mysqli_connect(hostname: $host,
username: $username,
password: $password,
database: $dbname);
if (mysqli_connect_errno()) {
die("Connection error: " . mysqli_connect_error());
}
$sql = "INSERT INTO `findmybustest` (route, location, time)
VALUES (?, ?, ?);";
$stmt = mysqli_stmt_init($conn);
if ( ! mysqli_stmt_prepare($stmt, $sql)) {
die(mysqli_error($conn));
}
mysqli_stmt_bind_param($stmt, "sss",
$route,
$currentStop,
$currentTime);
mysqli_stmt_execute($stmt);
echo "Record saved.";
?>
But when I ran it, the screen turned white (probably because of one of my error catching if statements) but I cant see the errors. I am completely new to SQL queries so please tell me what is the syntax error.