Hey there im currently try to create a page where I can insert some information into my SQL database, this is the php
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "film";
$conn = mysqli_connect($servername, $username, $password, $dbname);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$filmtitle = $_POST['filmtitle'];
$filmyear = $_POST['filmyear'];
$filmduration = $_POST['filmduration'];
$filmrating = $_POST['filmrating'];
$sql="INSERT INTO film (Title, FilmYear, Duration, FilmRating) VALUES
('$filmtitle', `$filmyear`, '$filmduration', '$filmrating',)";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else
{
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>
When I hit the submit button I get the following error, Object not found!
The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.
If you think this is a server error, please contact the webmaster.
Here is the HTML as well
<html>
<body>
<h1> Insert a new film!</h1>
<form action ="insert-film.php method="post">
Film Title: <input type="text" name="filmtitle">
Year: <input type="text" name="filmyear">
Duration: <input type="text" name="filmduration">
Certificate: <input type="text" name="filmcertificate">
<input type="submit">
</form>
</body>
</html>
" . $conn->error;` would have told you that. – Funk Forty Niner Feb 04 '16 at 15:44