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