我有猫,也有帖子,这是我的代码:
<?php
$sel_query = "SELECT * FROM cats ORDER BY cat_id ASC";
$result = mysqli_query($con,$sel_query);
while($data = mysqli_fetch_assoc($result))
{ // start insert cats
echo "<h1>Cat Name: ".$data["cat_id"]."</h1>";
$sel_query2 = "SELECT * FROM selecom WHERE cel_cat='".$data['cat_id']."' ";
$result2 = mysqli_query($con,$sel_query2);
while ($data2 = mysqli_fetch_assoc($result2))
{ // start insert posts
echo "<h2>Post: ".$data2['cel_golid']."</h2>";
echo "<h2>total Post Numbers in this cat: ?????????????????????????????????</h2>";
}
}
?>
我需要插入帖子总数(放置问号)
示例: 如果某只猫有2个帖子,我想在(问号位置)2中写帖子数。
*如果翻译不清楚,我表示歉意
答案 0 :(得分:0)
答案 1 :(得分:0)
检查下面的URL,您的疑问可能会澄清