Jump to content


Photo

mySQL coding assistance.


  • Please log in to reply
2 replies to this topic

#1 herbal_lavender

herbal_lavender
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 22 December 2005 - 07:42 PM

I am in need of assistance with this code. I'm attempting to make a table for a community. It seems everything is ok when I upload the .sql file except for this line.

create table bugs(bugid bigint primary key auto_increment, memberid bigint references members, bugtext text, type integer, bugdate DATE)

And this is what shows when I try to upload the file.

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 'create table bugs(bugid bigint primary key auto_increment, memb


Could someone help me.

Thanks.
Herbal_Lavender

#2 marker5a

marker5a
  • Members
  • PipPipPip
  • Advanced Member
  • 30 posts

Posted 22 December 2005 - 07:51 PM

I ran your command on my server and got no error, so I dumped the table from my server and came up with this query:

CREATE TABLE `bugs` (
`bugid` bigint(20) NOT NULL auto_increment,
`memberid` bigint(20) default NULL,
`bugtext` text,
`type` int(11) default NULL,
`bugdate` date default NULL,
PRIMARY KEY (`bugid`)
) TYPE=MyISAM

Give that a shot, and let us know how it works

Chris

#3 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 23 December 2005 - 09:52 PM

It's possible that you're trying to run that code on a server that doesn't have complete foreign key reference support for InnoDB table, so the parser is throwing the error. Using the CREATE TABLE syntax posted above -- as a MyISAM table -- should resolve your problem.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users