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
WBOYOriginal
2016-09-09 08:27:591383browse

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>
Statement:
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