I do not what to do because i think my coding is right please help me. in PHP Coding Help Posted April 16, 2020 <?php $Title=$_POST['title']; $Price=$_POST['price']; $Author=$_POST['author']; $con=mysqli_connect('localhost','root') or die("not connected"); mysqli_select_db($con,'BRM_DB'); $query="INSERT INTO book(title,Price,Author)values('$Title',$Price,'$Author')"; $result=mysqli_query($con,$query); mysqli_close($con); ?> <!DOCTYPE html> <html> <head> <title>Insertion</title> </head> <body> <h1>Book Record Management</h1> <p> <?php if($result==1) { echo ("Record inserted"); } else { echo ("insertion failed"); } ?> </p> <a href="insertform.php">click here</a> </body> </html> why it gives "insertion failed" as a result?
I do not what to do because i think my coding is right please help me.
in PHP Coding Help
Posted
<?php
$Title=$_POST['title'];
$Price=$_POST['price'];
$Author=$_POST['author'];
$con=mysqli_connect('localhost','root') or die("not connected");
mysqli_select_db($con,'BRM_DB');
$query="INSERT INTO book(title,Price,Author)values('$Title',$Price,'$Author')";
$result=mysqli_query($con,$query);
mysqli_close($con);
?>
<!DOCTYPE html>
<html>
<head>
<title>Insertion</title>
</head>
<body>
<h1>Book Record Management</h1>
<p>
<?php
if($result==1)
{
echo ("Record inserted");
}
else
{
echo ("insertion failed");
}
?>
</p>
<a href="insertform.php">click here</a>
</body>
</html>
why it gives "insertion failed" as a result?