Click to See Complete Forum and Search --> : Creating a Lookup Field using phpMyAdmin


JoelC
04-21-2006, 12:49 PM
This is my first time ever touching SQL or PHP. I realize I should probably learn the basics before jumping right in, but what I want seems easy enough to do using web tutorials, for now.

What I want to do is probably the easiest thing possible with SQL/PHP, I want to create a roster for a World of Warcraft guild. This includes these tables:

1) Race:
race_id (int) - key
race_name (varchar)

2) Classes:
class_id (int) - key
class_name (varchar)

3) tradeskill1
ts1_id (int) - key
tradeskill1 (varchar)

4) tradeskill2 (exactly like tradeskill 1)

5) Members
member_id (int) - key
name (varchar/text)
race_id (lookup field from Races)
class_id (lookup field from Classes)
ts1_id
ts2_id
comment (text)


---

Feel free to correct me if I'm using anything that shouldnt be used (say, VARCHAR where a CHAR or TEXT should be, I haven't really gotten a firm understanding on the terms yet).

I've worked for quite some time with Microsoft Access for creating tables (for projects that did not require any programming, SQL or PHP, so my technical knowledge isn't very inclusive) and have created this table very easily there. My problem here is that I don't have a clue how to create a field in the members table that draws it's information in a dropdown table (or something alike) from another table, like I do when I'm creating tables in Access.

---

Another question I would love to have answered here, is if it's possible to print this kind of table on to a .php page, using the Classes table to organize it, as seen in this design that I have planned for it:

http://www.fuzzit.com/rcta/roster.php


Thanks beforehand for your time.
Sincerely,
Joel

chazzy
04-21-2006, 01:16 PM
mysql has no concept of foreign keys out side of the innodb engine. most people don't use innodb. innodb is not for beginners. i would recommend you pick up a book, there are a lot out there about php/mysql for websites. they're all really good and should teach you a lot about what you are trying to accomplish.

JoelC
04-21-2006, 01:47 PM
Hrmm... ok, I guess, so I should just use numbers, then?

chazzy
04-21-2006, 05:42 PM
yes. you have to do this in your application though. you also have to validate everything in your application, mysql won't do it for you.

JoelC
04-22-2006, 10:45 AM
Thanks for the help, I went another way with it and it's working great now