Create a table with the foreach dongle

Hello,
I created two arrays, and I want to create a separate table for each brand with these two strings.

Sample table

I want to create a single row table for the brand with no results.
“The product from brand xxx is out of stock” as

If the array structure is wrong I can change it
Brands array

Array
(
    [0] => NEXT
    [1] => NEXT & NEXTSTAR
    [2] => SUNNY
    [3] => TEKNİKSAT
)

Array of contents

Array
(
    [0] => Array
        (
            [marka] => NEXT
            [daire_sayisi] => 153
            [toplam_cikis] => 156
            [json_encode] => {"216":1,"210":3,"208":1,"205":1}
            [rowspan] => 4
            [216] => 1
            [210] => 3
            [208] => 1
            [205] => 1
        )

    [1] => Array
        (
            [marka] => SUNNY
            [daire_sayisi] => 153
            [toplam_cikis] => 156
            [json_encode] => {"180":1,"174":3,"172":1,"169":1}
            [rowspan] => 4
            [180] => 1
            [174] => 3
            [172] => 1
            [169] => 1
        )

)

marka => brand
daire_sayisi and toplam_cikis => for information under each table
json_encode => To post into the radio button value=""
rowspan => radio button field for rowspan value
180, 174, 172, 169 => product IDs in the database
1,3,1,1 => product quantities

Note: I don’t want full HTML tables, just one column is enough

foreach($brand_array AS $brand){
    echo "
    <table class=\"table table-bordered\">
    <thead>
      <tr class=\"bg-primary\">
        <th class=\"col-md-0\">Seç</th>
        <th class=\"col-md-3\">Multiswitch Markası</th>
        <th class=\"col-md-3\">Multiswitch Tipi</th>
        <th class=\"col-md-3\">Girişi & Çıkışı</th>
        <th class=\"col-md-3\">B.Fiyatı</th>
        <th class=\"col-md-0\">Adet</th>
      </tr>
    </thead>
    <tbody>";
  
    foreach($other_array AS $value){

      if($value['marka'] == $brand){
        
          if(isset($value['daire_sayisi']) == 'daire_sayisi'){
            //echo "daire_sayisi: ".$satirlar['daire_sayisi']."<br />";
          }
          if(isset($value['toplam_cikis']) == 'toplam_cikis'){
            //echo "toplam_cikis: ".$satirlar['toplam_cikis']."<br />";
          }
          if(isset($value['json_encode']) == 'json_encode'){
            //echo "json_encode: ".$satirlar['json_encode']."<br />";
          }
          if(isset($value['rowspan']) == 'rowspan'){
            //echo "rowspan: ".$satirlar['rowspan']."<br />";
          }
          foreach($value AS $key => $value2){
          if(is_numeric($key)){ 
            //echo $key."---------".$value2."<br />";
            echo "\n<tr>\n<td>seç</td>\n<td>marka</td>\n<td>tipi</td>\n<td>giriş</td>\n<td>fiyat</td>\n<td>adet</td>\n</tr>";
          }
        }
        
      }
    }
    echo "</tbody>\n";
  echo "</table>\n";
  }

Can’t add a line for brand that is out of stock


I wrote wrong, it will not be Sunny, but Tekniksat

I’m confused, I just couldn’t get out of it
I ask for your help

Sponsor our Newsletter | Privacy Policy | Terms of Service