LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 02-28-2007, 01:21 AM   #1
Neko_D
Member
 
Registered: Oct 2006
Distribution: Ubuntu 6.10
Posts: 59

Rep: Reputation: 15
MySQL and MyPHPAdmin


So this is a general MySql question. In the database I am building I have serial numbers. Problem is these numbers are only unique within their individual category. So basically the serial number 2007-01 could be used in several different categories. So I am making the four columns that defines these categories into primary keys. Now I want use these categories as forigen keys. I am not sure how to declare multiple forgien keys. Could someone show me how to do this.

Also if someone is familiar with the program MyPHPAdmin. Could you tell me how to make forgien keys using the program?

Thanks for any help.
 
Old 02-28-2007, 03:15 AM   #2
baikonur
Member
 
Registered: Oct 2005
Location: germany
Distribution: debian
Posts: 255
Blog Entries: 5

Rep: Reputation: 30
what do you mean by 'category'?
what is a forgien key? do you mean foreign?
about how many tables are we talking here? just one?

advice: get familiar with the terminology. be exact! no programmer will take you serious when you don't even bother to spell the name of phpmyadmin correctly.
and...
DESCRIBE YOUR PROBLEM WELL!! make some effort. if you feel this is stupid, get away from programming.
 
Old 03-01-2007, 03:39 AM   #3
lorebett
Member
 
Registered: May 2004
Location: Italy
Distribution: Ubuntu, Gentoo
Posts: 57

Rep: Reputation: 16
Quote:
Originally Posted by Neko_D
Now I want use these categories as forigen keys. I am not sure how to declare multiple forgien keys. Could someone show me how to do this.
In order to use foreign keys you need your tables to be of type InnoDB.

When tables are InnoDB tables phpmyadmin also shows a menu to create relations.
 
Old 03-01-2007, 06:15 AM   #4
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
Posts: 4,244

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Well, it is still not clear what the OP means with 'categories' and apparently his problem is not so urgent that he cares to explain it to us. I assume that he means 'tables' though.

Now I am not really a MySQL crack, but I thought foreign key were needed to ensure referential integrety. That is, (among other things) you cannot delete a record from one table which is used (referred to) in another table.

It doesn't help for entries which are non-unique across tables. What is the problem with that anyway?

jlinkels
 
Old 03-01-2007, 03:41 PM   #5
Neko_D
Member
 
Registered: Oct 2006
Distribution: Ubuntu 6.10
Posts: 59

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by lorebett
In order to use foreign keys you need your tables to be of type InnoDB.

When tables are InnoDB tables phpmyadmin also shows a menu to create relations.
Thanks that is what I needed to know.
 
  


Reply

Tags
mysql


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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using myphpadmin wheel Mandriva 1 10-03-2006 11:53 AM
mysql:- can be accessed from shell but not from myphpadmin imagineers7 Linux - General 7 04-28-2006 09:07 AM
mysql:- can be accessed from shell but not from myphpadmin imagineers7 Linux - Software 1 04-28-2006 08:34 AM
Edit table in myphpadmin jbg_sm Programming 1 04-11-2005 01:42 PM
phpnuke mysql no myphpadmin 5amYan Linux - Software 1 11-14-2002 04:04 AM


All times are GMT -5. The time now is 06:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration