Code:
<?php
$dbhost ="";
$dbuser ="";
$dbpass ="";
$dbname ="school";
$db_table = "student";
$connection=@mysql_connect($dbhost,$dbuser,$dbpass);
if (!$connection) die ("Mysql connection error" .mysql_error());
error_reporting(E_ERROR | E_WARNING | E_PARSE);
mysql_select_db($dbname,$connection) or die ("Database connection error");
$query="INSERT INTO $db_table( ID, Name , Surname, Last Name, EGN, Course, Address)
VALUES
('NULL','{$_POST['Name']}','{$_POST['Surname']}','{$_POST['Last Name']}','{$_POST['EGN']}','{$_POST['Course']}','{$_POST['Address']}')";
if (!mysql_query($query,$connection))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($connection);
?>
I don't understand what's the problem
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 'Name, EGN, Course, Address) VALUES ('NULL','','',' ','','','')' at line 1
Comment