Good afternoon all. I've been getting the following error when running the following INSERT INTO statement.
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 ' , , , , , , , , , )' at line 2
I'm totally stumped. Could this be anything to do with the incremental value I have in my table called 'id'?? Here's the code. Many thanks in advance!!
<?php
$con=mysqli_connect("localhost","root","root","wexdemo");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$name = mysqli_real_escape_string($_POST['name']);
$address = mysqli_real_escape_string($_POST['address']);
$area = mysqli_real_escape_string($_POST['area']);
$postcode = mysqli_real_escape_string($_POST['postcode']);
$sector = mysqli_real_escape_string($_POST['sector']);
$subsector = mysqli_real_escape_string($_POST['subsector']);
$contact = mysqli_real_escape_string($_POST['contact']);
$position = mysqli_real_escape_string($_POST['position']);
$email = mysqli_real_escape_string($_POST['email']);
$telephone = mysqli_real_escape_string($_POST['telephone']);
$sql="INSERT INTO employers (name, address, area, postcode, sector, subsector, contact, position, email, telephone)
VALUES ($name, $address, $area, $postcode, $sector, $subsector, $contact, $position, $email, $telephone)";
if (!mysqli_query($con,$sql))
{
die('Error: ' . mysqli_error($con));
}
echo "1 record added";
mysqli_close($con);
?>
mysqli_prepare