mysql error

  • Nem
  • Guru
  • Guru
  • No Avatar
  • Joined: Feb 13, 2004
  • Posts: 1243
  • Loc: UK
  • Status: Offline

Post July 7th, 2004, 6:41 am

Error

SQL-query :

PHP Code: [ Select ]
CREATE TABLE gs_admin(
 
 
 
ipaddress VARCHAR( 32 ) NOT NULL default '',
 
lastvisit VARCHAR( 255 ) NOT NULL default '',
 
username VARCHAR( 40 ) NOT NULL default '',
 
pass VARCHAR( 32 ) NOT NULL default '',
 
 
 
)
  1. CREATE TABLE gs_admin(
  2.  
  3.  
  4.  
  5. ipaddress VARCHAR( 32 ) NOT NULL default '',
  6.  
  7. lastvisit VARCHAR( 255 ) NOT NULL default '',
  8.  
  9. username VARCHAR( 40 ) NOT NULL default '',
  10.  
  11. pass VARCHAR( 32 ) NOT NULL default '',
  12.  
  13.  
  14.  
  15. )


MySQL said:


#1064 - 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 ')' at line 5

---------------------------------------------------------
Whats the problem with the above?
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post July 7th, 2004, 6:41 am

  • Mr. Wiggles
  • Graduate
  • Graduate
  • No Avatar
  • Joined: Jul 05, 2004
  • Posts: 160
  • Loc: Brizzle
  • Status: Offline

Post July 7th, 2004, 6:43 am

Doesn't one of these have to be a primary key?
  • Nem
  • Guru
  • Guru
  • No Avatar
  • Joined: Feb 13, 2004
  • Posts: 1243
  • Loc: UK
  • Status: Offline

Post July 7th, 2004, 6:45 am

PHP Code: [ Select ]
CREATE TABLE gs_admin(
 
 
 
ipaddress VARCHAR( 32 ) NOT NULL default '',
 
lastvisit VARCHAR( 255 ) NOT NULL default '',
 
username VARCHAR( 40 ) NOT NULL default '',
 
pass VARCHAR( 32 ) NOT NULL default '',
 
) ;
  1. CREATE TABLE gs_admin(
  2.  
  3.  
  4.  
  5. ipaddress VARCHAR( 32 ) NOT NULL default '',
  6.  
  7. lastvisit VARCHAR( 255 ) NOT NULL default '',
  8.  
  9. username VARCHAR( 40 ) NOT NULL default '',
  10.  
  11. pass VARCHAR( 32 ) NOT NULL default '',
  12.  
  13. ) ;



???


not really, because there is only one admin.
  • Nem
  • Guru
  • Guru
  • No Avatar
  • Joined: Feb 13, 2004
  • Posts: 1243
  • Loc: UK
  • Status: Offline

Post July 7th, 2004, 6:48 am

the problem was i added a , at the end .... forgot...

Let that be a note to everyone... do not leave a comma on the last line
GSDomains.com -Click here - Packages starting from £3.69 a month. 1.5GB Space & 10GB Bandwidth.
  • Nem
  • Guru
  • Guru
  • No Avatar
  • Joined: Feb 13, 2004
  • Posts: 1243
  • Loc: UK
  • Status: Offline

Post July 7th, 2004, 7:23 am

what about this one:

PHP Code: [ Select ]
CREATE TABLE gs_news(
 
 
 
'id'MEDIUMINT( 64 ) NOT NULL AUTO_INCREMENT ,
 
`title` varchar( 64 ) NOT NULL ,
 
`introduction` varchar( 200 ) ,
 
`news` TEXT( 8000 ) NOT NULL ,
 
`datetime` Date / Time( 200 ) NOT NULL ,
 
`poster` varchar( 200 ) NOT NULL ,
 
PRIMARY KEY ( `id` )
 
)
  1. CREATE TABLE gs_news(
  2.  
  3.  
  4.  
  5. 'id'MEDIUMINT( 64 ) NOT NULL AUTO_INCREMENT ,
  6.  
  7. `title` varchar( 64 ) NOT NULL ,
  8.  
  9. `introduction` varchar( 200 ) ,
  10.  
  11. `news` TEXT( 8000 ) NOT NULL ,
  12.  
  13. `datetime` Date / Time( 200 ) NOT NULL ,
  14.  
  15. `poster` varchar( 200 ) NOT NULL ,
  16.  
  17. PRIMARY KEY ( `id` )
  18.  
  19. )
  • Scorpius
  • Proficient
  • Proficient
  • User avatar
  • Joined: Mar 20, 2004
  • Posts: 401
  • Loc: Scorpion Hole
  • Status: Offline

Post July 7th, 2004, 8:13 am

Yea thats pretty simple.
PHP Code: [ Select ]
CREATE TABLE gs_news(
 
 
 
`id` MEDIUMINT( 64 ) NOT NULL AUTO_INCREMENT ,
 
`title` varchar( 64 ) NOT NULL ,
 
`introduction` varchar( 200 ) ,
 
`news` TEXT NOT NULL ,
 
`datetime` DATE NOT NULL ,
 
`poster` varchar( 200 ) NOT NULL ,
 
PRIMARY KEY ( `id` )
 
)
  1. CREATE TABLE gs_news(
  2.  
  3.  
  4.  
  5. `id` MEDIUMINT( 64 ) NOT NULL AUTO_INCREMENT ,
  6.  
  7. `title` varchar( 64 ) NOT NULL ,
  8.  
  9. `introduction` varchar( 200 ) ,
  10.  
  11. `news` TEXT NOT NULL ,
  12.  
  13. `datetime` DATE NOT NULL ,
  14.  
  15. `poster` varchar( 200 ) NOT NULL ,
  16.  
  17. PRIMARY KEY ( `id` )
  18.  
  19. )

That should work for you.
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Joined: May 28, 2003
  • Posts: 23404
  • Loc: Woodbridge VA
  • Status: Offline

Post July 7th, 2004, 8:24 am

nem,

please use either the php or the code buttons when posting code. Thanks
"There's no place like 127.0.0.1 except for ::1."
Alexandria Networks. Leader in IT consulting for associations/non-profits, and small to medium sized businesses around the northern Virginia and Washington D.C. metro area.
  • Scorpius
  • Proficient
  • Proficient
  • User avatar
  • Joined: Mar 20, 2004
  • Posts: 401
  • Loc: Scorpion Hole
  • Status: Offline

Post July 7th, 2004, 8:35 am

Thanks, hoping someone was going to say something about that. :P
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Joined: May 28, 2003
  • Posts: 23404
  • Loc: Woodbridge VA
  • Status: Offline

Post July 7th, 2004, 8:50 am

Well, the interesting thing is that if the php code was used in the first place, nem may have noticed that the apostrophes used around id showed up in red indicating invalid syntax and would have probably corrected it on his own.

I like using HTML Kit for php and asp code because it has a similar color scheme making it much easier to spot syntax errors.
"There's no place like 127.0.0.1 except for ::1."
Alexandria Networks. Leader in IT consulting for associations/non-profits, and small to medium sized businesses around the northern Virginia and Washington D.C. metro area.
  • Scorpius
  • Proficient
  • Proficient
  • User avatar
  • Joined: Mar 20, 2004
  • Posts: 401
  • Loc: Scorpion Hole
  • Status: Offline

Post July 7th, 2004, 12:04 pm

Yes, it is very good to use a program that has color highlighting to do code like ASP and PHP. I use Dev-PHP. It has highlighting for a few different languages.
If you want to try it out. It is free and is open source so you can probably do some modifications yourself if you want.
http://devphp.sourceforge.net/
  • Mr. Wiggles
  • Graduate
  • Graduate
  • No Avatar
  • Joined: Jul 05, 2004
  • Posts: 160
  • Loc: Brizzle
  • Status: Offline

Post July 7th, 2004, 12:13 pm

Scorpius wrote:
I use Dev-PHP/

SNAP!
  • Scorpius
  • Proficient
  • Proficient
  • User avatar
  • Joined: Mar 20, 2004
  • Posts: 401
  • Loc: Scorpion Hole
  • Status: Offline

Post July 7th, 2004, 4:16 pm

Mr. Wiggles wrote:
SNAP!

SNAP! What?

Post Information

  • Total Posts in this topic: 12 posts
  • Users browsing this forum: No registered users and 228 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.