Re: DB_DataObject 2 joins to same table
| From: | Ken Restivo | Date: | Mon, 29 Nov 2004 23:05:22 +0000 |
| Subject: | Re: DB_DataObject 2 joins to same table | ||
| References: | 1 2 3 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-15908@lists.php.net to get a copy of this message | ||
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Mon, Nov 29, 2004 at 09:49:17AM +0100, Leo M?rquez wrote:
> [USER]
> user_id (pk)
> user_name
> user_firstcar
> user_secondcar
>
I don't know PEAR very well, but it seems that the "right" way to do the table from a
relational DB standpoint is something like:
[USER]
user_id
user_name
[USER_CAR_JOIN]
user_car_join_id (pk)
user_id
car_id
[CAR]
car_id (pk)
car_name
car_color
car_model
Another advantage is that you can have more than 2 cars without having to change your DB schema and
all your forms.
Although I find *visually* presenting this kind of relationship really, really hard in FormBuilder.
My application is structured like this, and I've been banging my head against the wall trying
to find a clean way to design forms that deal with this kind of schema.
- -ken
- --
- ---------------
The world's most affordable web hosting.
http://www.nearlyfreespeech.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
iD8DBQFBq6sye8HF+6xeOIcRAvDfAKCX5xn3vSIc6OCMY1LpjyZoUbYzIwCfSKUS
OeV5nxn3roUBybjomi+eodQ=
=T8HP
-----END PGP SIGNATURE-----