Creating a table within a table
Posted 21 February 2006 - 11:01 PM
Could anyone tell me how to get around this dillemma ? The help would be greatly apprecaited!
Posted 21 February 2006 - 11:17 PM
(member_id, rank, class, name, email, etc.)
(raid_id, raid_name, raid_description, raid_date, etc)
(ID, member_id, raid_id, any info about the member for that raid)
Then you use either member_id to get all the raids for a single person or raid_id to get everyone in a raid.
Believe me, you do not want seperate tables for all of your raids. That was my thought process when I first started and its totally wrong. Relational databases are much easier to code for and deal with.
Posted 21 February 2006 - 11:23 PM
Posted 21 February 2006 - 11:25 PM
[!--quoteo(post=348074:date=Feb 21 2006, 05:23 PM:name=DrAwesomePhD)--][div class=\'quotetop\']QUOTE(DrAwesomePhD @ Feb 21 2006, 05:23 PM) [/div][div class=\'quotemain\'][!--quotec--]
Aw :-/ so basically i should make a login script and use the login names as unique ID's for signing up for the raids. That makes sense.... so much for being lazy thanks for the help!!
Posted 22 February 2006 - 05:33 AM
Raid id: Member ID: 1 11 1 14 1 9 1 27 1 31 1 18 2 11 2 21 2 17 2 24 2 22
Just as some rnadom numbers, but the thats the basic pattern?
The problem i run into seems to be in the actual coding... so i want to print this out in some sort of reliable fashion... I'm really quite stumped on how you are supposed to do this using these multiple tables and have a clean set of code. The only thing i could think of doing is querrying the combined_raid table, making multiple arrays (one for each class) and storing all the member_id's inside of them for people who have signed up for the same raid_id, and then doing another query with lots of for loops to print the arrays out with even more querries inside of it for the specific member info.... but tahts really really really messy code :-/ surely theres a better way to use MySQL to simply get ALL the info you need and just sorting through it? Please someone help
Posted 22 February 2006 - 08:08 AM
Posted 22 February 2006 - 05:53 PM
Posted 22 February 2006 - 07:50 PM
SELECT m.* FROM Combined_raids AS cr, members AS m WHERE cr.member_id = m.member_id AND cr.raid_id = '<raid_id_here>'
Posted 22 February 2006 - 09:31 PM
What does the "AS m" and "AS cr" mean? and how does that relate to cr.member_id...
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users