I'm making a website for the first time using PHP with a MySQL database and getting a syntax error that I don't understand. I just want to delete everything from tblreparation
with a certain ID
and also everything from rblrepstat
with that same ID
. I am using this code:
<?php
$con=mysqli_connect("localhost","root","MYPASS","repair");
$ID = $_REQUEST['ID'];
$sql = mysqli_query($con, "DELETE FROM tblreparation WHERE ID = {$ID}");
if (!mysqli_query($con,$sql)) {
die('Error: ' . mysqli_error($con));
}
$sql = mysqli_query($con, "DELETE FROM tblrepstat WHERE repID = {$ID}");
if (!mysqli_query($con,$sql)) {
die('Error2: ' . mysqli_error($con));
}
echo "1 record deleted";
mysqli_close($con);
?>
And this is the error I am getting:
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1' at line 1
Near 1? I don't even see a '1'...