What does she mean? Please give an example of when this link needs to be established. A better life example is when such a connection is made.
And how do I write to the database that one object has several values?
What does she mean? Please give an example of when this link needs to be established. A better life example is when such a connection is made.
And how do I write to the database that one object has several values?
UPD. Example. Let there be two kinds of users:
Authors - can create posts; Editors can add and edit posts (something similar to ru.SO). Thus, the following relationship is obtained: One-Ko-Many between the author and posts and Many-Ko-Many between editors and posts. The tables will be as follows: users
id | name ---+------ 1 | Vasya 2 | Petya 3 | Vanya post id | title | autor_id | text ---+-------+----------+--------------- 1 | PHP | 1 | Blah-blah-blah post_editor user_id | post_id --------+--------- 2 | 1 3 | 1 Thus, we can see that the PHP post created Vasya, and edited Petya and Vanya (the many-to-many relationship is implemented through a secondary table).
An example of a one-to-many relationship is the relationship that exists between a mother and her children. A mother can have many children, but each child can have only one mother.
Source: https://ru.stackoverflow.com/questions/691309/
All Articles