Link to home
Start Free TrialLog in
Avatar of Yaku Kakashi
Yaku Kakashi

asked on

PHP dataTable boostrap Table How to hide duplicate values on cell

dataTable boostrap Table How to hide duplicate values on cell?..
Form this

and I want to display my table like this

How can I achieve this experts?...
ASKER CERTIFIED SOLUTION
Avatar of Yaku Kakashi
Yaku Kakashi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of NerdsOfTech
In the future, I recommend that you keep a question open so that you can get answers from others; for low priority marked questions like this one, it may take a few days to get experts to answer.

Additional recommendations include: stating information about the database you are using, and the code used to output the table.

With just the small amount of information given, I can hypothesize you have connected to the database and are outputting the data via while loop.

Thus, presuming the data is sorted, while in the loop you could assign the current columns in a 2d array and then do an if (or an in-line ternary if as in my example) against the previous values to output   (non-breaking space) cells on match.

$prev = array('Branch' => '', 'Outlet' => '');  // used to compare previous row data against the current row, to show blank cells for duplicated data
while($row = $result->fetch_assoc()) {
 echo '<tr>';
 echo '<td>' . ($row['Branch'] == $prev['Branch']) ? '&nbsp;' : $row['Branch'] . '</td>'
 $prev['Branch'] = $row['Branch']; 
 echo '<td>' . ($row['Outlet'] == $prev['Outlet']) ? '&nbsp;' : $row['Branch'] . '</td>'
 $prev['Branch'] = $row['Outlet']; 
 // ...
 echo '</tr>';
}

Open in new window