Jump to content

Archived

This topic is now archived and is closed to further replies.

black.horizons

hard to title! about numbers of objects and MySQL

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Regards
Rich

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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?

Regards
Rich

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
The above table structure would allow for that and you wouldn't need to save any details about them.

Regards
Rich

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.