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
I got this above error while running super easy code that any idiot can build it, so I don't know what and where or is my machine needs to be turned on and off or my luck is not working. Please help me or I'll start crying.
<?php
$con=mysqli_connect("localhost","root","some password","test");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql=mysqli_query($con,"INSERT INTO users(first_name, last_name, username,password,email)
VALUES('$_POST[fname]', '$_POST[lname]', '$_POST[username]', '$_POST[password]','$_POST[email]')");
if (!mysqli_query($con,$sql))
{
die('Error: ' . mysqli_error($con));
}
header("Location:reg.php?remarks=success");
echo " record added";
mysqli_close($con);
?>