Getting data from MySQL and inserting into a table

As for the create php (where the check gets it from), here is the new code, does $_GET[] still work for it?

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
  die("Connection failed: " . $conn->connect_error);
}

// prepare and bind
$stmt = $conn->prepare("INSERT INTO bookings (user, starttime, endtime, table, host, day, userid) VALUES (?, ?, ?, ?, ?, ?, ?)");
$stmt->bind_param("sssssss", $user, $starttime, $endtime, $table, $host, $day, $userid);

// set parameters and execute
$user = $_GET[$user];
$starttime = $_GET[$starttime];
$endtime = $_GET[$endtime];
$table = $_GET[$table];
$host = $_GET[$host];
$day = $_GET[$day];
$userid = $_GET[$userid];
$stmt->execute();


echo "New records created successfully";

$stmt->close();
$conn->close();

There you go! Looks better. Get will still work, yes.

Sorry for the slow reply I was watching Gogglebox.

It throws back this error

I just was watching TikTok… for 3 hours sorry. PHP has that error documented, but see it’s a boolean. I believe that means the request failed, or succeeded, but I do not remember right off the op of my head.

1 Like

Ahh ok, thank you

Really30charjustreally