| | |
Problem in inserting query in database
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Feb 2009
Posts: 130
Reputation:
Solved Threads: 0
Hi everyone,
I am inserting value in a table in a database through query but it is giving some error as like this :-
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 'leave (session_id,empid,leave,year) values('20202', 'DTL0009', '21', '2009')' at line 1
and the code for inserting these value is as i writing this code:-
But i am receiving this error. I am unable to insert records in database. Please help me. How i can sort out this problem.
Thanks,
Gagan
I am inserting value in a table in a database through query but it is giving some error as like this :-
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 'leave (session_id,empid,leave,year) values('20202', 'DTL0009', '21', '2009')' at line 1
and the code for inserting these value is as i writing this code:-
$sqlquery = "insert into leave (session_id,empid,leave,year) values('$_SESSION[id]', '$_SESSION[empid]', '$_POST[leavenum]', '$_POST[year]')";
$res = mysql_query($sqlquery,$link) or die('Error: ' . mysql_error());But i am receiving this error. I am unable to insert records in database. Please help me. How i can sort out this problem.
Thanks,
Gagan
leave is a mysql statement. try putting backticks around it.
MySQL Syntax (Toggle Plain Text)
$sqlquery = "insert into `leave` (session_id,empid,`leave`,year) values('$_SESSION[id]', '$_SESSION[empid]', '$_POST[leavenum]', '$_POST[year]')"; $res = mysql_query($sqlquery,$link) OR die('Error: ' . mysql_error());
"If it is NOT source, it is NOT software."
-- NASA
-- NASA
![]() |
Similar Threads
- How to insert data into database? (JSP)
- DATE problem (PHP)
- Problem inserting Record to the database pls help (PHP)
- problem in inserting data into the database (PHP)
- Problem in inserting data to the database (ASP)
- Problem inserting data into database (JSP)
Other Threads in the MySQL Forum
- Previous Thread: Password Encryption
- Next Thread: How to access new user Accounts, it always logs into my Root
Views: 292 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for MySQL
"use" 1 amazon api artisticlicense aws bizspark breathalyzer camparingtocolumns changingprices cmg communityjournalism contentmanagement contractors copyright count court crm data database design developer development distinct drupal dui ec2 eliminate email enter eudora facebook form foss gartner gnu government greenit groklaw groupware hiring hyperic images innerjoins ip joebrockmeier journalism keyword keywords kickfire laptop law legal license licensing linux managing mariadb matchingcolumns metron micromanage microsoft microsoftexchange mindtouch montywidenius mozilla multiple music mysql mysqlindex mysqlinternalqueries mysqlquery mysqlsearch news opendatabasealliance opengovernment opensource operand pdf penelope php priceupdating query remove reorderingcolumns results resultset saas search select simpledb sourcecode spotify sql statement syntax techsupport thunderbird transparency virtualization





