Please support our MySQL advertiser: Programming Forums
![]() |
•
•
Join Date: Sep 2007
Posts: 31
Reputation:
Rep Power: 2
Solved Threads: 1
This is an annoying error...tried re-writing the code a few times...deleting and recreating the table...etc...still the same result:
" ...
You have an error in your SQL syntax; check the manual that corresponds to your MYSQL version for the right syntax to use near 'desc) VALUES ( '', '1', '1', '2007', '', '')' at line 1
..."
I've checked the table...its the proper name being used "calendar" (and yup, all lower case)
the table consists of:
id INT NOT NULL AUTO_INCREMENT ,
day VARCHAR( 2 ) NOT NULL ,
month VARCHAR( 2 ) NOT NULL ,
year VARCHAR( 4 ) NOT NULL ,
link VARCHAR( 255 ) NOT NULL ,
desc TEXT NOT NULL
Anyone have any ideas what might be causing this? Been trying for over 4 hours to get this little bit of code to work....grrrrr! LOL
MYSQL is version 4.1.22
" ...
You have an error in your SQL syntax; check the manual that corresponds to your MYSQL version for the right syntax to use near 'desc) VALUES ( '', '1', '1', '2007', '', '')' at line 1
..."
<?php
require_once "dbconnect.php"; // include the database information
$day = $_POST["day"];
$month = $_POST["month"];
$year = $_POST["year"];
$link = $_POST["link"];
$desc = $_POST["desc"];
mysql_query("INSERT INTO calendar (id, day, month, year, link, desc) VALUES ( '', '$day', '$month', '$year', '$link', '$desc')") or die("something went wrong adding the event. MySQL said: ".mysql_error());
?>I've checked the table...its the proper name being used "calendar" (and yup, all lower case)
the table consists of:
id INT NOT NULL AUTO_INCREMENT ,
day VARCHAR( 2 ) NOT NULL ,
month VARCHAR( 2 ) NOT NULL ,
year VARCHAR( 4 ) NOT NULL ,
link VARCHAR( 255 ) NOT NULL ,
desc TEXT NOT NULL
Anyone have any ideas what might be causing this? Been trying for over 4 hours to get this little bit of code to work....grrrrr! LOL
MYSQL is version 4.1.22
Last edited by verbob : Nov 17th, 2007 at 7:13 pm.
•
•
Join Date: Sep 2007
Posts: 31
Reputation:
Rep Power: 2
Solved Threads: 1
OK!
It seems that some of my choice of variables may have been "reserved" words...simply putting them between ` ` and all is well
It seems that some of my choice of variables may have been "reserved" words...simply putting them between ` ` and all is well
"INSERT INTO calendar (`id`, `day`, `month`, `year`, `link`, `desc`) VALUES (NULL, '$day', '$month', '$year', '$link', '$desc')"
![]() |
Similar Threads
Other Threads in the MySQL Forum
- syntax error? .. operator overload method problemo (C)
- syntax error that I just can't seem to find! (Visual Basic 4 / 5 / 6)
- UPDATE syntax error (MySQL)
- Subshell Problem, syntax error...Help please! (Shell Scripting)
- DECLARATION SYNTAX ERROR (for bc 31 user) (C++)
- Parse error, syntax error, Forbids declaration (C++)
Other Threads in the MySQL Forum
- Previous Thread: Theoretical Question
- Next Thread: Problem to connect Servlet and JDBC
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)





Linear Mode