Jump to content

hard to title! about numbers of objects and MySQL


black.horizons

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.