Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 03-18-2010, 11:53 AM MySQL Error 1005
Webmaster Talker

Posts: 626
Trades: 0
Can anyone please shed some light on why this code is returning Error 1005?
Code:
CREATE TABLE IF NOT EXISTS `#__tracker_employees` (
  `employeeid` SMALLINT(4) UNSIGNED NOT NULL auto_increment,
  `name` VARCHAR(50) NOT NULL,
  `address` TINYTEXT,
  `phone` VARCHAR(14),
  `email` VARCHAR(80),
  `sin` CHAR(9),
  `type` VARCHAR(25),
  PRIMARY KEY (`employeeid`),
  UNIQUE KEY (`sin`)
)  TYPE=InnoDB;

CREATE TABLE IF NOT EXISTS `#__tracker_paystubs` (
  `stubid` SMALLINT(4) UNSIGNED NOT NULL auto_increment,
  `employeeid` SMALLINT(4) UNSIGNED NOT NULL,
  `chequenumber` TINYINT(5) UNSIGNED,
  `date_period` DATE,
  `date_pay` DATE,
  `notes` TEXT,
  PRIMARY KEY (`stubid`),
  FOREIGN KEY (`employeeid`) REFERENCES `#__tracker_employees` (`employeeid`)
) TYPE=InnoDB;

CREATE TABLE IF NOT EXISTS `#__tracker_payitems` (
  `payitemid` SMALLINT(4) UNSIGNED NOT NULL auto_increment,
  `categoryid` SMALLINT(4) UNSIGNED NOT NULL,
  `desc` TINYTEXT,
  `amount` DECIMAL(10,2),
  `split` TINYINT(2) UNSIGNED,
  PRIMARY KEY (`payitemid`),
  FOREIGN KEY (`categoryid`) REFERENCES `#__tracker_categories` (`categoryid`)
) TYPE=InnoDB;

CREATE TABLE IF NOT EXISTS `#__tracker_categories` (
  `categoryid` SMALLINT(4) UNSIGNED NOT NULL auto_increment,
  `name` VARCHAR(25),
  PRIMARY KEY (`categoryid`)
) TYPE=InnoDB;
Here is the exact error message:
Code:
Can't create table './sharedsite_lwerS/rwql_tracker_payitems.frm' (errno: 150) SQL=CREATE TABLE IF NOT EXISTS `rwql_tracker_payitems` ( `payitemid` SMALLINT(4) UNSIGNED NOT NULL auto_increment, `categoryid` SMALLINT(4) UNSIGNED NOT NULL, `desc` TINYTEXT, `amount` DECIMAL(10,2), `split` TINYINT(2) UNSIGNED, PRIMARY KEY (`payitemid`), FOREIGN KEY (`categoryid`) REFERENCES `w5ql_tracker_categories` (`categoryid`) ) TYPE=InnoDB;
SQL =

CREATE TABLE IF NOT EXISTS `rwql_tracker_payitems` (
  `payitemid` SMALLINT(4) UNSIGNED NOT NULL auto_increment,
  `categoryid` SMALLINT(4) UNSIGNED NOT NULL,
  `desc` TINYTEXT,
  `amount` DECIMAL(10,2),
  `split` TINYINT(2) UNSIGNED,
  PRIMARY KEY (`payitemid`),
  FOREIGN KEY (`categoryid`) REFERENCES `w5ql_tracker_categories` (`categoryid`)
) TYPE=InnoDB;

Last edited by jim.thornton; 03-18-2010 at 11:57 AM..
jim.thornton is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-18-2010, 12:13 PM Re: MySQL Error 1005
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
does this table already exist???

`w5ql_tracker_categories`

As it is being referenced in the FOREIGN KEY definition.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-18-2010, 12:17 PM Re: MySQL Error 1005
Webmaster Talker

Posts: 626
Trades: 0
None of these tables exist. This is an SQL file called install.sql that I am using to install a component into Joomla.

Does the CREATE TABLE for the categories need to be executed first?
jim.thornton is offline
Reply With Quote
View Public Profile
 
Old 03-18-2010, 12:27 PM Re: MySQL Error 1005
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
Does the CREATE TABLE for the categories need to be executed first?
Yes ...
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-18-2010, 12:31 PM Re: MySQL Error 1005
Webmaster Talker

Posts: 626
Trades: 0
Perfect, thank you.
jim.thornton is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to MySQL Error 1005
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.14947 seconds with 12 queries