Error importing

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
thefreebielife
Forum Contributor
Posts: 126
Joined: Thu Apr 26, 2007 2:59 pm

Error importing

Post by thefreebielife »

I have been using the same code over and over when I had my stuff on PowWeb, but i just swicthed to StartLogic and now when I try to import this code:

Code: Select all

CREATE TABLE `bugs` (
  `username` text NOT NULL,
  `description` text NOT NULL,
  `date` timestamp NOT NULL default '0000-00-00 00:00:00'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
I get this error:

Code: Select all

#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 'ENGINE=MyISAM DEFAULT CHARSET=latin1' at line 5 
User avatar
Gente
Forum Contributor
Posts: 252
Joined: Wed Jun 13, 2007 9:43 am
Location: Ukraine, Kharkov
Contact:

Post by Gente »

Looks like you use different versions of MySQL. Try to import it

Code: Select all

CREATE TABLE `bugs` (
  `username` text NOT NULL,
  `description` text NOT NULL,
  `date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
);
thefreebielife
Forum Contributor
Posts: 126
Joined: Thu Apr 26, 2007 2:59 pm

Post by thefreebielife »

Seems to work, but what would I do with stuff like this (bottom line):

Code: Select all

CREATE TABLE `users` (
  `uId` int(6) NOT NULL auto_increment,
  `username` text NOT NULL,
  `password` text NOT NULL,
  `fname` text NOT NULL,
  `phone` text NOT NULL,
  `email` text NOT NULL,
  `address` text NOT NULL,
  `city` text NOT NULL,
  `state` text NOT NULL,
  `zip` text NOT NULL,
  `country` text NOT NULL,
  `ip` text NOT NULL,
  `gid` int(6) NOT NULL default '0',
  `rid` int(6) NOT NULL default '0',
  `ostatus` double NOT NULL default '0',
  `holdreason` text NOT NULL,
  `astatus` tinyint(4) NOT NULL default '0',
  `date` text NOT NULL,
  `deadline` text NOT NULL,
  `dead` tinyint(4) NOT NULL default '0',
  PRIMARY KEY  (`uId`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
I need those increments.
User avatar
Gente
Forum Contributor
Posts: 252
Joined: Wed Jun 13, 2007 9:43 am
Location: Ukraine, Kharkov
Contact:

Post by Gente »

Keep them. Increments should be imported without problems.
thefreebielife
Forum Contributor
Posts: 126
Joined: Thu Apr 26, 2007 2:59 pm

Post by thefreebielife »

Now I am getting an error with this one:

Code: Select all

CREATE TABLE `deadoffers` (
  `username` text NOT NULL,
  `offer` text NOT NULL,
  `date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
) 
Is there someone I can read about what needs to be changed?
User avatar
Gente
Forum Contributor
Posts: 252
Joined: Wed Jun 13, 2007 9:43 am
Location: Ukraine, Kharkov
Contact:

Post by Gente »

Remove

Code: Select all

ON UPDATE CURRENT_TIMESTAMP
Just follow the error messages.
thefreebielife
Forum Contributor
Posts: 126
Joined: Thu Apr 26, 2007 2:59 pm

Post by thefreebielife »

I get the same error as before.

I am so confused and have no idea what to do, I didn't know different versions could mess this up.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Why are most of the fields TEXT?

If you make the following query on the server with the error, what does it return?

Code: Select all

SELECT VERSION();
thefreebielife
Forum Contributor
Posts: 126
Joined: Thu Apr 26, 2007 2:59 pm

Post by thefreebielife »

Most of the fields are text because I thought that would be the easiest since the input of most of them varies.

It returns 4.0.16

this is now causing an error:

Code: Select all

-- --------------------------------------------------------

-- 
-- Table structure for table `offers`
-- 

CREATE TABLE `offers` (
  `oId` int(6) NOT NULL auto_increment,
  `oCampID` int(11) NOT NULL default '0',
  `oaffiliate` text NOT NULL,
  `oCost` text NOT NULL,
  `oName` text NOT NULL,
  `oDescription` text NOT NULL,
  `oLink` text NOT NULL,
  `oImage` text NOT NULL,
  `oInstructions` text NOT NULL,
  `oWait` text NOT NULL,
  `oweight` text NOT NULL,
  `ocountry` text NOT NULL,
  PRIMARY KEY  (`oId`)
) 
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Post by califdon »

Look up the proper syntax for CREATE TABLE in MySQL 4.0 http://dev.mysql.com/doc/refman/4.1/en/ ... table.html
Post Reply