GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 22-Feb-2007, 02:28
newtophp newtophp is offline
New Member
 
Join Date: Feb 2007
Posts: 3
newtophp is on a distinguished road
Cool

New tophp/mysql


I am using phpMy admin to create my tables in my database. I want to use the type InnoDB and then declare foreign keys. I have assigned the type to InnoDB, how do I add the reference clause in phpMyAdmin?
If you can help me with this I would be very grateful
  #2  
Old 22-Feb-2007, 10:38
TurboPT's Avatar
TurboPT TurboPT is offline
Senior Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 1,233
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: New tophp/mysql


I don't know how far phpmyadmin [PMA] has come along lately, but the version I have [2.8.0.2] doesn't handle/support the foreign key (FK) manipulation directly through the GUI. I either have to use an SQL statment in a PMA SQL window, or at the MySQL command line to make FK adjustments.

Even though I do have FKs specified, my PMA version only detects/lists them as 'indexes'.

You might be able to poke around PMA's website for more info. (unless another poster might have a better response)

EDIT: I do have a newer version of PMA at home, (not sure what version) but I'll check what it can/'t do with FKs and I'll post again by Saturday.
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
  #3  
Old 22-Feb-2007, 12:43
newtophp newtophp is offline
New Member
 
Join Date: Feb 2007
Posts: 3
newtophp is on a distinguished road

Re: New tophp/mysql


Thank you, I will use the SQl window as you suggest, uless you come back with another solution!
  #4  
Old 23-Feb-2007, 19:53
TurboPT's Avatar
TurboPT TurboPT is offline
Senior Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 1,233
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: New tophp/mysql


The other version I have is 2.9.1.1, and it DOES support FK's! (now that I've found this, I need to double check my 2.8 version...)

When viewing a table's structure, there is a 'Relation view' link just below the list of fields, but before clicking the link...
1. The field(s) that you would like to become FK candidates must be in the 'Indexes' list (down a little more on the same screen).
2. For each candidate field, in the 'Action' column (far right), click the 'lightning bolt' [index] icon and it will add them to that indexes list.
3. Now click the 'Relation view' link.
4. A 'Links to' listing will appear, and you'll see three combo boxes next to all the entries that appeared in the indexes list:
(the PK field(s) will appear too, but ignore them and only set the fields that will become FKs)
  • The first combo is where you choose the association [parent] table & id pair. (For example, a typical entry will appear like this: user->user_id )
  • The other two combos is where you choose the actions for the ON DELETE, and ON UPDATE clauses [the list is same for both]
Then just click the save button near the bottom!
(oh, the save doesn't actually refresh the screen nor will it return to the previous screen -- didn't for me, anyway -- but you can go to a SQL window and verify what it did by issuing this query: SHOW CREATE TABLE tableName -- to check the FK creation(s) in the result)

Volia!
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
  #5  
Old 25-Feb-2007, 14:34
newtophp newtophp is offline
New Member
 
Join Date: Feb 2007
Posts: 3
newtophp is on a distinguished road

Re: New tophp/mysql


Thank you fro your reply.
  #6  
Old 26-Feb-2007, 11:24
TurboPT's Avatar
TurboPT TurboPT is offline
Senior Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 1,233
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: New tophp/mysql


(post #4 followup)...the 2.8.0.2 version supports FKs too!
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
 
 

Recent GIDBlogVista ?Widgets? on Windows XP by LocalTech

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 20:05.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.