ThinkPHP + Mysql associated Model for help

Source: Internet
Author: User
There are two tables. The userpic table is an image-uploaded table, and the dynamic table is a user-published dynamic list, the values of the userpic_id field in dynamic correspond to the userpic_id field in the iddynamic table of the userpic table. what can I do to separate the IDs and...

There are two tables. The userpic table is an image-uploaded table, and the dynamic table is a user-published dynamic list. The values of the userpic_id field in dynamic correspond to the IDs of the userpic table.
The userpic_id field in the dynamic table has the following strings: 5, 4, 3, 1, 2.

1. How can I associate each id in the string with the id of the userpic table?
2. How is the Association, one-to-many or many-to-many?

Reply content:

There are two tables. The userpic table is an image-uploaded table, and the dynamic table is a user-published dynamic list. The values of the userpic_id field in dynamic correspond to the IDs of the userpic table.
The userpic_id field in the dynamic table has the following strings: 5, 4, 3, 1, 2.

1. How can I associate each id in the string with the id of the userpic table?
2. How is the Association, one-to-many or many-to-many?

When you query a table, you can directly query the where uid in. one-to-many queries are needed to view more of your project. However, many-to-many management is troublesome.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.