black.horizons Posted September 13, 2006 Share Posted September 13, 2006 Hi there,Basically my idea was to have a file with variables names i.e. $team_number [where the value is from 1 upto an unknown number - probably no more than 30], and for each number have a MySQL table. I was thinking at the start of initially having the 30 tables, with 30 scripts - one script/page per table. However they all run off the same format... $date = $contact -> date; $arrange = $contact -> arrange; $notes = $contact -> notes; $member1 = $contact -> member1; $member2 = $contact -> member2; $member3 = $contact -> member3; $member4 = $contact -> member4; $member5 = $contact -> member5; $member6 = $contact -> member6; $member7 = $contact -> member7; $member8 = $contact -> member8; $member9 = $contact -> member9; $member10 = $contact -> member10; $member11 = $contact -> member11; $member12 = $contact -> member12; $member13 = $contact -> member13; $member14 = $contact -> member14; $member15 = $contact -> member15; $member16 = $contact -> member16; $member17 = $contact -> member17; $member18 = $contact -> member18; $member19 = $contact -> member19; $member20 = $contact -> member20; $member21 = $contact -> member21; $member22 = $contact -> member22;Every "$member" field just holds the name of a member of the team - basically for management to know how is working on which team.Is there a way to make one template file instead of 30 files - one per table, which can write to any of the 30 tables, depend on which link was clicked to get there if you know what i mean.Also at the minute, with the rest of the script I have, I keep all my database connections in a seperate database.php file, and call each of them by calling a function through a form.Can anybody even tell me whether this is a good idea or not!?!TIA, Alex Quote Link to comment https://forums.phpfreaks.com/topic/20604-hard-to-title-about-numbers-of-objects-and-mysql/ Share on other sites More sharing options...
HuggieBear Posted September 13, 2006 Share Posted September 13, 2006 Sounds like a very bad idea!I can't see exactly what you're trying to do here, but your database design is key... You could probably do what you're after with two or three tables and save yourself a hell of a lot of coding.[color=green][size=8pt][b]Table 1[/b] (members) - unique_id, member_name, team_id[b]Table 2[/b] (teams) - unique_id, team_name[/size][/color]You can link the member.team_id to the teams.unique_id to receive the info you needed.RegardsRich Quote Link to comment https://forums.phpfreaks.com/topic/20604-hard-to-title-about-numbers-of-objects-and-mysql/#findComment-90969 Share on other sites More sharing options...
black.horizons Posted September 13, 2006 Author Share Posted September 13, 2006 yeah, actuallly upon reflection I can see that I could have one MASSIVE table, with the 30 teams worth of data entered in, but basically there is a manager for every team, and they can only see their one team page for editing, so i'd need to have a fiddle around with it.To tell you the truth I should hang my head in shame..i have no DB design...at all! To the drawing board! Quote Link to comment https://forums.phpfreaks.com/topic/20604-hard-to-title-about-numbers-of-objects-and-mysql/#findComment-90972 Share on other sites More sharing options...
HuggieBear Posted September 13, 2006 Share Posted September 13, 2006 OK, don't worry,How about something like this.[color=green][size=8pt][b]Table 1[/b] (members) - unique_id, member_name, team_id, manager_id[b]Table 2[/b] (teams) - unique_id, team_name, manager_id[/size][/color]This will allow you to do everything you need. Do you want a few examples?RegardsRich Quote Link to comment https://forums.phpfreaks.com/topic/20604-hard-to-title-about-numbers-of-objects-and-mysql/#findComment-90982 Share on other sites More sharing options...
black.horizons Posted September 13, 2006 Author Share Posted September 13, 2006 i think i have it sorted...but I don't need to store any information about the members, just the team lists, and their managers.I'll have to think more about it, but when I do get it sorted i'll leave a note! Cheers Huggie! Quote Link to comment https://forums.phpfreaks.com/topic/20604-hard-to-title-about-numbers-of-objects-and-mysql/#findComment-90986 Share on other sites More sharing options...
HuggieBear Posted September 13, 2006 Share Posted September 13, 2006 The above table structure would allow for that and you wouldn't need to save any details about them.RegardsRich Quote Link to comment https://forums.phpfreaks.com/topic/20604-hard-to-title-about-numbers-of-objects-and-mysql/#findComment-90990 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.