•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 455,964 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,609 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser: Programming Forums
Views: 828 | Replies: 1 | Solved
![]() |
| |
•
•
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')"
![]() |
•
•
•
•
•
•
•
•
DaniWeb MySQL Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- 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


Hybrid Mode