Re: Having more than one id in the same field

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Perhaps you could store all of the IDs in a varchar type (I'm assuming 
you're using some SQL database or another) separated by spaces or 
colons or anything else that wouldn't be in an ID. Then you can get the 
separate IDs by Exploding the result in PHP. That's probably not the 
best way to do this, but it's the first way I can think of.

> Hi. I have a database designing question to ask.
> I want to build a table of events. Among the other fields there must 
> be a
> field that holds the 'responsible organization' of the event. This
> organization of course will be responsible for other events as well so 
> I
> have to create another table that holds the organizations (id, name, 
> phones,
> director etc) and then just pull the organization id to the events 
> table.
> The problem is that it happens too often to have 2 organizations 
> responsible
> for the same event so I'll have to add them both to the events table 
> in the
> same record.
>
> How do you advice me to do that?
> I thought that I could use a text field to hold the ids and then when
> searching the database just change the MySQL command from
> "...where events.id='$id'..." (As it would be if only one id was going 
> to be
> used) to
> "...where '$id' in (events.ids)..." or maybe something using LIKE.
>
> Do you think it can be done this way? Apart from the responsible
> organization I may have other fields in the same table having the same
> problem (for example: the event visitors are staying in one hotel and 
> I want
> to hold control of the hotels as well. Maybe 2 hotels are used instead 
> of
> one). If I solve my problem this way, do you think that it will be too
> difficult or 'heavy' to have more than one condition like this in my
> queries?
> Do you think of any other way?
>
> Thanx in advance....
> Achilles

--
Adam Atlas

Your mouse has moved. Windows has to reboot for changes to take effect. 
[ OK ]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux