<table id="datatable-buttons" class="table table-striped table-bordered dt-responsive nowrap" style="border-collapse: collapse; border-spacing: 0; width: 100%;">
<thead>
<tr>
<th>SL</th>
<th>Name</th>
<th>Department</th>
<th>Course</th>
<th>Unit</th>
<th>Contact No</th>
<th>Address</th>
<th>Picture</th>
<th>Date/Time</th>
</tr>
</thead>
<tbody>
<?php
$query=mysqli_query($db_con,'SELECT * FROM `student_info` ORDER BY `student_info`.`datetime` DESC;');
$i=1;
while ($result = mysqli_fetch_array($query)) { ?>
<tr>
<?php
echo '<td>'.$i.'</td>
<td>'.ucwords($result['name']).'</td>
<td>'.ucwords($result['department']).'</td>
<td>'.ucwords($result['course']).'</td>
<td>'.ucwords($result['unit']).'</td>
<td>'.ucwords($result['pcontact']).'</td>
<td>'.ucwords($result['address']).'</td>
<td>'.ucwords($result['datetime']).'</td>
<td><img class="rounded-circle avatar-xl" src="images/'.$result['photo'].'" ></td>';?>
</tr>
<?php $i++;} ?>
</tbody>
</table>
All i want to achieve is when department is Computer color should be blue, when is Agric, color should be green, when is Kinetic color should be red etc.
source https://stackoverflow.com/questions/67756517/i-want-to-change-the-php-row-text-based-on-the-value-from-the-database-with-php
Comments
Post a Comment