Answers for "add <tr> after 4 <td> using php"

PHP
0

add <tr> after 4 <td> using php

$return_var = "<table style=\"width:100%;\">";
$index = 1;
while($value = mysqli_fetch_array($result))
{
  if($index == 1){
    $return_var .= "<tr>";
  }
  $return_var .= "<td style=\"width:90px\"><strong>Plan_name : ".$value["plan_name"]."</strong></td>";
  if($index % 4 === 0){
    $return_var .= "</tr><tr>";
  }
  $index++;
}

$return_var .= "</tr></table>";
Posted by: Guest on October-09-2020

Browse Popular Code Answers by Language