Home > Backend Development > PHP Tutorial > thinkphp loops to query the data of table A, how to use the ID of table A to query the data of table B, how to add the data of table B to the loop and display it in the view

thinkphp loops to query the data of table A, how to use the ID of table A to query the data of table B, how to add the data of table B to the loop and display it in the view

WBOY
Release: 2016-09-09 08:27:59
Original
1381 people have browsed it

thinkphp loops to query the data of table A, how to use the ID of table A to query the data of table B, how to add the data of table B to the loop and display it in the view

thinkphp loops to query the data of table A, how to use the ID of table A to query the data of table B, how to add the data of table B to the loop and display it in the view

Reply content:

thinkphp loops to query the data of table A, how to use the ID of table A to query the data of table B, how to add the data of table B to the loop and display it in the view

thinkphp loops to query the data of table A, how to use the ID of table A to query the data of table B, how to add the data of table B to the loop and display it in the view

<code>foreach ($six_month as $k => $v) {
    $six_upload = $upload->where("month_id={$vo['id']}")->find();
    $six_month[$k]['upload'] = $six_upload;
}
$this->assign('six_month', $six_month);</code>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template