PHP SMARTY部分循环

Before I explain the issue let me first put the codes.

PHP

$pro_attr = $pdo->prepare("SELECT * FROM `product_attributes` WHERE pat_product = :id GROUP BY pat_group");
$pro_attr-> bindValue(':id', $_GET['id']);
$pro_attr-> execute();

$data = array();
while($pro_attr_res = $pro_attr->fetch()){
  $nameattrGroup = $pdo->prepare("SELECT * FROM `attribute_groups` WHERE atg_id = :id");
  $nameattrGroup-> bindValue(':id', $pro_attr_res['pat_group']);
  $nameattrGroup-> execute();
  $nameattrGroup_res = $nameattrGroup->fetch();

  $atrGrpName = $nameattrGroup_res['atg_name'];

  $selectAttr = $pdo->prepare("SELECT * FROM `attributes` WHERE atr_group = '$pro_attr_res[pat_group]'");
  $selectAttr-> execute();

  while($selectAttr_res = $selectAttr->fetch()){
    $patValue = $pdo->prepare("SELECT * FROM `product_attributes` WHERE pat_id = '$selectAttr_res[atr_id]'");
    $patValue-> execute();
    $patValue_res = $patValue->fetch();

    $data[$atrGrpName][] = $selectAttr_res['atr_name'];
    $data[$atrGrpName][] = $patValue_res['pat_value'];
  }
}
$smarty->assign('attrs', $data);

Smarty

{foreach from=$attrs key=atrGroup item=atrs}
   <h3>{$atrGroup}</h3>
   <table class="table table-striped table-hover">
       {section loop=$atrs name=d}
           <tr>
              <td class="col-md-4">{$atrs[d]}</td>
              <td></td>
           </tr>
       {/section}
   </table>
{/foreach}

Okay, so now here {$atrs[d]} prints the value of both $selectAttr_res['atr_name'] and $patValue_res['pat_value'] together creating a new <tr>. I want these two to be displayed in the same <tr> in two <td>'s. Like this:

<tr>
   <td>Value of `$selectAttr_res['atr_name']`</td> 
   <td>Value of `$patValue_res['pat_value']`</td>
</tr>

How to do that? Please help.

Changing your code that gets data from the database would be the easiest:

// code
$data[$atrGrpName][] = [$selectAttr_res['atr_name'], $patValue_res['pat_value']];
// code

Then, you can add both columns for each row:

{foreach from=$attrs key=atrGroup item=atrs}
   <h3>{$atrGroup}</h3>
   <table class="table table-striped table-hover">
       {section loop=$atrs item=atr}
           <tr>
              <td class="col-md-4">{$atr[0]}</td>
              <td>{$atr[1]}</td>
           </tr>
       {/section}
   </table>
{/foreach}