Dynamic rowspan while fetching records from database

后端 未结 4 2072
情深已故
情深已故 2020-12-10 21:43
Ename   Sal      
tom     100
tom     200
bill    100
bill    250
bill    450
bill    400

This is the query and html structure which has given the

4条回答
  •  天命终不由人
    2020-12-10 22:41

    You can check condition like this with the last row and the current row.

    $sql = "select * from emp";
    $result= mysql_query($sql);
    echo "";
    while($row=mysql_fetch_array($result))
    { 
      $now=$row[0];
      if($last!=$now) {
      echo "";
      }else{
      echo "";
      }
      $last = $row[0];
     }
    echo "
    $row['ename']$row['esal']
     $row['esal']
    ";

    I hope this will help you.

提交回复
热议问题