• <i id='CW9Nd'><tr id='CW9Nd'><dt id='CW9Nd'><q id='CW9Nd'><span id='CW9Nd'><b id='CW9Nd'><form id='CW9Nd'><ins id='CW9Nd'></ins><ul id='CW9Nd'></ul><sub id='CW9Nd'></sub></form><legend id='CW9Nd'></legend><bdo id='CW9Nd'><pre id='CW9Nd'><center id='CW9Nd'></center></pre></bdo></b><th id='CW9Nd'></th></span></q></dt></tr></i><div id='CW9Nd'><tfoot id='CW9Nd'></tfoot><dl id='CW9Nd'><fieldset id='CW9Nd'></fieldset></dl></div>

    <legend id='CW9Nd'><style id='CW9Nd'><dir id='CW9Nd'><q id='CW9Nd'></q></dir></style></legend>

    <small id='CW9Nd'></small><noframes id='CW9Nd'>

      • <bdo id='CW9Nd'></bdo><ul id='CW9Nd'></ul>

      1. <tfoot id='CW9Nd'></tfoot>

        循环时我无法在里面创建 num 行

        时间:2023-09-20

          <tbody id='4eyGK'></tbody>

          <bdo id='4eyGK'></bdo><ul id='4eyGK'></ul>
                <i id='4eyGK'><tr id='4eyGK'><dt id='4eyGK'><q id='4eyGK'><span id='4eyGK'><b id='4eyGK'><form id='4eyGK'><ins id='4eyGK'></ins><ul id='4eyGK'></ul><sub id='4eyGK'></sub></form><legend id='4eyGK'></legend><bdo id='4eyGK'><pre id='4eyGK'><center id='4eyGK'></center></pre></bdo></b><th id='4eyGK'></th></span></q></dt></tr></i><div id='4eyGK'><tfoot id='4eyGK'></tfoot><dl id='4eyGK'><fieldset id='4eyGK'></fieldset></dl></div>
                <legend id='4eyGK'><style id='4eyGK'><dir id='4eyGK'><q id='4eyGK'></q></dir></style></legend>
                <tfoot id='4eyGK'></tfoot>

                1. <small id='4eyGK'></small><noframes id='4eyGK'>

                2. 本文介绍了循环时我无法在里面创建 num 行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我有拖车第一个表:对于产品第二个表:对于类别

                  i have tow tables first table : For products Second Table : For Categories

                  我想像这样在浏览器中显示

                  i want to show in browser like this

                  类别 1 (20)类别 2 (5)类别3 (3)

                  category1 (20) category2 (5) category3 (3)

                  $select_sub_cat = mysql_query("SELECT * FROM sub_cat WHERE ct_id='".$row_main['id']."' ");
                  while($row_sub = mysql_fetch_array($select_sub_cat))
                  {
                    $select_num_sub = mysql_query("SELECT * FROM market WHERE sub_cat='".$row_sub['id']."' ");
                    $row_num_sub = mysql_num_rows($select_num_sub);
                    $smarty->assign('numb',$row_num_sub);
                  
                   $sub_cats[] = $row_sub;
                  }
                  $smarty->assign('sub_cats',$sub_cats);
                  

                  推荐答案

                  尝试

                  $select_sub_cat = mysql_query("SELECT * FROM sub_cat WHERE ct_id='".$row_main['id']."' ");
                  while($row_sub = mysql_fetch_array($select_sub_cat))
                  {
                    $select_num_sub = mysql_query("SELECT * FROM market WHERE sub_cat='".$row_sub['id']."' ");         
                   $sub_cats[] = $row_sub;
                   $sub_cats['count']=mysql_num_rows($select_num_sub);
                  }
                  $smarty->assign('sub_cats',$sub_cats);
                  

                  然后打电话给你的聪明人:

                  and then call on your smarty :

                  {$sub_cats.name} ({$sub_cats.count})//$sub_cats.name 应该是类别的名称"

                  {$sub_cats.name} ({$sub_cats.count}) // $sub_cats.name should be 'name' of category

                  这篇关于循环时我无法在里面创建 num 行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何在另一个查询的 while 循环中运行 sql 查询 下一篇:嵌套 while 循环只运行一次

                  相关文章

                  最新文章

                  <tfoot id='4RrmC'></tfoot>

                    • <bdo id='4RrmC'></bdo><ul id='4RrmC'></ul>
                  1. <i id='4RrmC'><tr id='4RrmC'><dt id='4RrmC'><q id='4RrmC'><span id='4RrmC'><b id='4RrmC'><form id='4RrmC'><ins id='4RrmC'></ins><ul id='4RrmC'></ul><sub id='4RrmC'></sub></form><legend id='4RrmC'></legend><bdo id='4RrmC'><pre id='4RrmC'><center id='4RrmC'></center></pre></bdo></b><th id='4RrmC'></th></span></q></dt></tr></i><div id='4RrmC'><tfoot id='4RrmC'></tfoot><dl id='4RrmC'><fieldset id='4RrmC'></fieldset></dl></div>

                    <small id='4RrmC'></small><noframes id='4RrmC'>

                      <legend id='4RrmC'><style id='4RrmC'><dir id='4RrmC'><q id='4RrmC'></q></dir></style></legend>