- <?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
3 1654
Name is a reserved key word in SQL, you should rename the column.
and column names should not have spaces either.
thanks :))
I corrected it
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Savas Ates |
last post by:
i have a stored below
it uses create temp table and drop temp table... when more than one user
request the same page it probably returns error.. how can i solve this
problem
...
|
by: Murtix Van Basten |
last post by:
HI all,
I am trying to migrate a database from mysql to mssql2k. I use myODBC to
connect to mysql server to pull the database from DTS and insert in to sql
server. But in mysql server, there is...
|
by: David Findlay |
last post by:
I'm trying to do a table for laying out a links page in CSS. See
http://qldstorms.com/links.php. My stylesheet is at
http://qldstorms.com/styles/screen.css. My problem is that if the link name
in...
|
by: Bri |
last post by:
Greetings,
I'm having a very strange problem in an AC97 MDB with ODBC Linked tables
to SQL Server 7. The table has an Identity field and a Timestamp field.
The problem is that when a new record...
|
by: erikcw |
last post by:
Hi,
I'm trying to insert some data from an XML file into MySQL. However,
while importing one of the files, I got this error:
Traceback (most recent call last):
File "wa.py", line 304, in ?...
|
by: quartz |
last post by:
Hello,
I have a txt file with names, years, days. How can I insert table using shell scripting???
Thenks a lot,
|
by: Steve Kelley |
last post by:
Hello all. I'm new to this group and I'm working on my first real VB.Net
project. I'm having trouble creating and archive of a database. We use
an Access database to store results from our...
|
by: tvnaidu |
last post by:
database file gets created using below sql file, then lua script calls "db.import config_ascc", then I get errors says "insert table failed for eventLog", below are my sql file entry, config file,...
|
by: josephamarks |
last post by:
I am trying to correct a table problem.
In IE6, the table (created in VS with ASPX) does display correctly.
Ijn IE8, it adds unwanted horizontal scrollbars, and the columns do not display...
|
by: sprofis |
last post by:
when executing an insert query in java it is not updating the table with the new values.
i've noticed that the problem occurs when the tables contain key/keys. it shows that the query was executed...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |