The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> PHPmyadmin, Innodb, Foreign Keys - How to setup foreign keys in PHPmyadmin
Rating  4
colinkites2000
post Aug 10 2009, 03:52 PM
Post #1


Member
***

Group: Members
Posts: 59
Joined: 11-July 08
Member No.: 6,143



Hello,

I'm trying to setup foreign keys but PHPmyadmin won't give me the option to select innodb. I checked this tutorial http://www.mytechmusings.com/2008/04/using...s-in-mysql.html which is quite good, but the option to select innobd is not there for me. Does this mean my server might not support innodb?

Perhaps I can do this with myisam?

I've have a product table listing products, with an auto-incrementing primary key.

I also have a location table listing where on the website that product will go. IE "index4" would put the product in the 4th table in the index. In this table, I have 3 columns - An auto-incrementing primary key, the product ID and the location. Originally, I had the product ID as the primary key and somehow setup a working relationship but then I was running into problems since the product ID's had duplicates - they were duplicated in order to list the different locations. So then I realized that the primary key should be unique and added an auto-incrementing id column. However, now I cannot get these tables to relate.

1. Do I need to switch to innodb for this application? I don't need referential integrity at this point, maybe it's a good idea though.
2. How can I make these two tables relate through phpmyadmin so that my JOIN will work again?

SELECT products.Range_RPM
FROM products INNER JOIN locations ON locations.Product_Id = products.Product_Id
WHERE locations.Location = 'index4'

Best,
C





User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
go4ashu
post Mar 17 2011, 12:54 AM
Post #2





Group: Members
Posts: 1
Joined: 17-March 11
Member No.: 14,147



QUOTE(colinkites2000 @ Aug 10 2009, 03:52 PM) *

Hello,

I'm trying to setup foreign keys but PHPmyadmin won't give me the option to select innodb. I checked this tutorial http://www.mytechmusings.com/2008/04/using...s-in-mysql.html which is quite good, but the option to select innobd is not there for me. Does this mean my server might not support innodb?

Perhaps I can do this with myisam?

I've have a product table listing products, with an auto-incrementing primary key.

I also have a location table listing where on the website that product will go. IE "index4" would put the product in the 4th table in the index. In this table, I have 3 columns - An auto-incrementing primary key, the product ID and the location. Originally, I had the product ID as the primary key and somehow setup a working relationship but then I was running into problems since the product ID's had duplicates - they were duplicated in order to list the different locations. So then I realized that the primary key should be unique and added an auto-incrementing id column. However, now I cannot get these tables to relate.

1. Do I need to switch to innodb for this application? I don't need referential integrity at this point, maybe it's a good idea though.
2. How can I make these two tables relate through phpmyadmin so that my JOIN will work again?

SELECT products.Range_RPM
FROM products INNER JOIN locations ON locations.Product_Id = products.Product_Id
WHERE locations.Location = 'index4'

Best,
C




Hello,

myisam engine wont allow you to add foreign key constraint..you will definately have to use innodb ..if you are not able to find so i can surely let you know how to do so..
After creating table on your db open that particular table and go to operations part of it which will be given in the top of list ..on opening it you will find storage engine ..you can select innodb from there and then set foreign key relation
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 28th March 2024 - 04:19 AM