Gossamer Forum
Home : General : Databases and SQL :

Stupid error?

Quote Reply
Stupid error?
Hi. Can anyone see a problem with the SQL?

CREATE TABLE Articles ( Title CHAR(40) NOT NULL, Short TEXT NOT NULL, Full TEXT NOT NULL, TimeStmp INT NOT NULL, Date TEXT NOT NULL, Category TEXT NOT NULL, Image TEXT, PRIMARY KEY (TimeStmp) )

I get the following error;

You have an error in your SQL syntax near 'Full TEXT NOT NULL, TimeStmp INT NOT NULL, Date TEXT NOT NULL, Ca' at line 5 at (eval 4) line 139.

Maybe I'm just being blind? Unsure

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Stupid error? In reply to
Couple suggestions:

1) To make your SQL statement SQL-99 compliant (meaning can be used with other RDBMS), you should consider changing Date column to something like Article_Date.

2) Also change Full to Article_Full, while you do have a space between Full and TEXT (FULLTEXT is actually a reserved word in MySQL).

3) Change Image TEXT to Image TEXT NULL

Syntaxically speaking, your SQL statement looks okay. But may be the above suggestions may help.

For more info on MySQL reserved words, check out the following web page:

http://www.mysql.com/.../Reserved_words.html
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [Stealth] Stupid error? In reply to
Ahhh.. your right.. it was the 'Full' field. Damn thats a pain in the arse.. means I gotta reprogram all the calls to that in my script :(

Thanks for the advice (I did look up Reserved_Words on mySQL... but must have missed that one Frown)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Stupid error? In reply to
Yea, that sucks...but you may be able to get away with using `Full` (with the back ticks) as the column alias in your SQL statements.

Like:

table.Article_Full AS `Full`
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [Stealth] Stupid error? In reply to
Nah.. thats too complicated, and jsut leaves more rooms for other problem. Gonna edit my 6 1000+ line scripts now :(

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Stupid error? In reply to
Well, you should be able to use the Find and Replace feature in your text editor, save time with manually editing your queries.
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [Stealth] Stupid error? In reply to
Yeah... I can't though, cos if I do that, it will modify some of the hard coded templates I have in there for the admin panel Frown

I'm about 50% of the way done now.. may as well keep doing it this way. At least I know the code changes will be safe then :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!