Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql showing error #1

Open
Behramand opened this issue Feb 9, 2018 · 6 comments
Open

sql showing error #1

Behramand opened this issue Feb 9, 2018 · 6 comments

Comments

@Behramand
Copy link

Error
SQL query:

CREATE TABLE orders (
id int(11) unsigned NOT NULL AUTO_INCREMENT,
Title varchar(255) DEFAULT NULL,
First varchar(255) DEFAULT NULL,
Middle varchar(255) DEFAULT NULL,
Last varchar(255) DEFAULT NULL,
ProductId int(11) unsigned NOT NULL,
NumberShipped int(11) DEFAULT NULL,
OrderDate date DEFAULT NULL,
PRIMARY KEY (id),
KEY order_product_fk (ProductId),
CONSTRAINT order_product_fk FOREIGN KEY (ProductId) REFERENCES products (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
MySQL said: Documentation

#1005 - Can't create table inventorymanager_2017-06-22.orders (errno: 150 "Foreign key constraint is incorrectly formed") (Details…)

@cilinbilly
Copy link

where i can download the InventoryManager.sql file?

@Behramand
Copy link
Author

fix the sql problem thankyou ...

@nsandison
Copy link

Error is due to script trying to create orders table without products table. Use products section of script first to create products table, then create orders and that works OK. Likewise, create suppliers before purchases for same reason. Doing that gave me the four tables with the data in them.

@kazudv
Copy link

kazudv commented Feb 19, 2019

where i can download the InventoryManager.sql file?

yes where is that ? so confusing for the beginners ~

@Behramand
Copy link
Author

Behramand commented Feb 19, 2019

Error is due to script trying to create orders table without products table. Use products section of script first to create products table, then create orders and that works OK. Likewise, create suppliers before purchases for same reason. Doing that gave me the four tables with the data in them.

I learn a lot about php and mysql .
Thanks for quick response

@Behramand
Copy link
Author

where i can download the InventoryManager.sql file?

yes where is that ? so confusing for the beginners ~

Thanks for Answering me i solve this problem and learn alot about php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants