Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
572 B
2
Indexable
Never
<?php
$sr="localhost";
$user="root";
$pass="";
$dbname="cafe";
$conn = new mysqli($r, $user, $pass, $dbname);

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

// Get data from the form
$pname = $_POST['**'];
$price = $_POST['**'];

// Insert data into the "drinks" table
$sql = "INSERT INTO **";

if ($conn->query($sql) === TRUE) {
    echo "Drink added successfully";
} else {
    echo "Error: " . $sql . "<br>" . $conn->error;
}

// Close the database connection
$conn->close();
?>
Leave a Comment