Re: question about the design of table's structure

2006-07-07 Thread [EMAIL PROTECTED]

>
> Not sure exactly what you mean, but I think that generally you would use a
> third table for this.
>
> As an example, take the famous blog case.
>
> We have posts and comments. Post hasMany Comment and Comment belongsTo Post.
> But Post also has an author, as does Comment.
>
> So we create User, and make:
> User hasMany Post
> Post belongsTo User
> Comment belongsTo User
>
> User
>   id
> Post
>   id
>   user_id
> Comment
>   id
>   user_id
>   post_id
>
> --
> Regards,
> Ryan Ginstrom

According to  your example:

If Post have several flelds and more than one fields need the id of
User table.
id
user_id   (the first user's id)
user_id   (another user's id)

how do it?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: question about the design of table's structure

2006-07-06 Thread [EMAIL PROTECTED]

My english is not good.

Thanks for your help.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



RE: question about the design of table's structure

2006-07-06 Thread Ryan Ginstrom

> [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
> Hi there. Here's my problem:if  two fields at a table belong 
> to another
> table,how do i design the two table's structure and name the relating
> fields?

Not sure exactly what you mean, but I think that generally you would use a
third table for this.

As an example, take the famous blog case.

We have posts and comments. Post hasMany Comment and Comment belongsTo Post.
But Post also has an author, as does Comment. 

So we create User, and make:
User hasMany Post
Post belongsTo User
Comment belongsTo User

User
id
Post
id
user_id
Comment
id
user_id
post_id

--
Regards,
Ryan Ginstrom


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



question about the design of table's structure

2006-07-06 Thread [EMAIL PROTECTED]

Hi there. Here's my problem:if  two fields at a table belong to another
table,how do i design the two table's structure and name the relating
fields?

thanks a lot!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---