How does php call data in two associated data tables?

Source: Internet
Author: User
How does php call $ query & nbsp ;=& nbsp; $ db-& gt; query ("SELECT & nbsp; list_dir, list_id, list_name, list_status & nbsp; FROM & nbsp; ff_list & nbsp; WHERE & nbsp; list_statu php: how to call data in two associated data tables
$query = $db->query("SELECT list_dir,list_id,list_name,list_status FROM ff_list WHERE list_status != 0 ORDER BY list_id ASC LIMIT 0, 30");
while($n = $db->fetch_array($query)) {


$query = $db->query("SELECT vod_name,vod_cid FROM ff_vod WHERE vod_cid in ($n['list_id']) ORDER BY rand() LIMIT 0, 10");
while($m = $db->fetch_array($query)) {

        $z[]='".$n['list_name'].$m['vod_name'].'';
}
}


How to use double while call or other call methods to achieve the desired effect
The ff_list data table is a column list.
Ff_vod is the document list
The joined fields of the two tables are vod_cid = list_id.
All the topic names in the ff_list are called, and 10 articles are displayed under the topic name. how can this problem be called at one time? you can see many forums or CMS


For example:
Topic name: Military News
Aaaaaaaaaaaaaaaaa
Bbbbbbbbbbbbbbbbbbb
Ccccccccccccccc
Ddddddddddddddd
Eeeeeeeeeeeeeeeeeee

Topic Name: Entertainment News
Ffffffffffffffff
Gggggggggggggggggg
Hhhhhhhhhhhhhhhhhhhh
...........


The younger brother is a Cainiao. if you have any trouble, you can give the code directly. thank you.
Share: More

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.