I want to show/hide table row based on status values of the fetched columns for mysql using php.
Working Code: This section is working fine
while($row = mysql_fetch_array($sql))
{
$name[] = $row['name'];
$title[] = $row['title'];
$prize[] = $row['prize'];
$status[] = $row['status']; // this will save values as enabled or disabled
$points[] = $row['points'];
}
<?php
while($row = mysql_fetch_array($sql))
{
echo "<tr> ";
echo "<td>" .$row[name] . "</td>";
echo "<td>" .$row[points] . "</td>";
}
echo "</tr> " ;
?>
Problem: I need solution for this
I cant display the table as given above due to some more values, that will be taken from other tables, to be shown into the table rows. I am displaying the tables like this.
<tr ><td><?php echo "$title[0]";?></td><td>complete <?php echo "$task[0]";?> </td><td></td></tr>
<tr ><td><?php echo "$title[1]";?></td><td>complete <?php echo "$task[1]";?> </td><td></td></tr>
Question:
Kindly guide me how I hide or show the rows , as defined in problem section , using the value of
$status[] = $row['status'];
, which will be enabled or disabled
if($row['status'] == 1) { display } else { not display }