Notice: Undefined variable: query in C:\xampp\htdocs\Project\EBY.php on line 87
ErrorINSERT INTO birth(Date, Celeb,Venue,STime,ETime,Guest,Age,Gender,Theme,Letter,Email,First,Last,Contact) VALUES('','','','',','','','','','','','','','')You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '','','','','','','','','','')' at line 2
<?php
$servername = "localhost";
$username = "root";
$password = "";
$Date = $_POST['Date'];
$nc = $_POST['nc'];
$ven = $_POST['ven'];
$STime = $_POST['STime'];
$ETime = $_POST['ETime'];
$Gue = $_POST['Gue'];
$Gen= $_POST['Gen'];
$Letter = $_POST['Letter'];
$Theme = $_POST['Theme'];
$fir = $_POST['first'];
$las = $_POST['last'];
$con = $_POST['con'];
$email = $_POST['Email'];
$age = $_POST['Age'];
$dbname = "dcprog";
$conn = new mysqli($servername, $username, $password, $dbname);
if($conn -> connect_error){
echo("Connection Failed" . $conn -> connect_error);
}
$sql = "INSERT INTO birth(Date, Celeb,Venue,STime,ETime,Guest,Age,Gender,Theme,Letter,Email,First,Last,Contact)
VALUES('$Date','$nc','$ven','$STime','$ETime,'$Gue','$age','$Gen','$Theme','$Letter','$email','$fir','$las','$con')";
if($conn -> query($sql) === TRUE) {
if($Gue < 50)
{
echo"<table align="center" width="700" cellspacing="5" cellpadding="5"><tbody><tr><td><center><h2>Reciept</h2></center></td></tr></tbody></table><hr>";
echo"<table align="center" width="450" cellspacing="5" cellpadding="5"><tbody><tr><td><center> ";
echo"</center></td></tr></tbody></table><hr>";
echo"<width = 550 cellspacing = 5 cellpadding =5><table align="center" width="550" cellspacing="5" cellpadding="5"><tbody><tr><td>";
echo"</td></tr><tr><td>Day of the Event:</td><td>". $Date;
echo"</td></tr><tr><td>Name of the Celebrant:</td><td>" . $nc;
echo"</td></tr><tr><td>Venue:</td><td>" . $ven;
echo"</td></tr><tr><td>Starting Time of the Venue:</td><td>". $STime ;
echo"</td></tr><tr><td>Ending Time of the Venue:</td><td>". $ETime ;
}
if($Gue < 50)
{
$pack = 10000;
$inclu = "Catering, Invitation letters and Location of the Party of the Party";
$them = 2000;
echo"</td></tr><tr><td>Invited Guest:</td><td>". $Gue;
}
else if($Gue < 75 )
{
$pack = 12000;
$them = 2000;
$inclu = "Catering, Invitation letters, Location of the Party of the Party and Band";
echo"</td></tr><tr><td>Invited Guest:</td><td>" . $Gue;
}
else if($Gue < 100)
{
$pack = 20000;
$them = 2000;
$inclu = "Unli-Catering, Invitation letters, Location of the Party of the Party and Band";
}
else if( $Gue < 150)
{
$pack = 22000;
$them = 2000;
$inclu = "Unli-Catering, Invitation letters, Location of the Party of the Party, Host and Band";
echo"</td></tr><tr><td>Invited Guest:</td><td>" . $Gue;
}
echo"</td></tr><tr><td>Theme:</td><td>". $evt;
echo"</td></tr><tr><td>Cake Price:</td><td>". $them ."pesos";
echo"</td></tr><tr><td>Wish to create Invitation:</td><td>". $Letter;
echo"</td></tr><tr><td>Package:</td><td>". $pack ."pesos";
echo"</td></tr><tr><td>Includes:</td><td>". $inclu;
$t = $pack + $them;
echo"</td></tr><tr><td>Total Payment :</td><td>". $t . "pesos";
echo"</td></tr><tr><td>Thank You ". $las ." ". $fir . "We will contact at this No. ". $con . " Or with this email " . $email;
echo"</td></tr><tr><td>For any changes or Questions please contact us 091271304852 or email us Schoolfiles11@gmail.com";
echo"</td></tr></tbody></table>";
}
else {
echo "Error".$query.$sql. $conn -> error;
}
$conn -> close();
?>
What I have tried:
I dunno what to do I already try to change the db but it didnt work