Jump to content

Simple Right? Exclude rows from being displayed


motleycrewl

Recommended Posts

I'm having a hard time finding a way to exclude certain rows from being displayed in my table. Im making a simple table for hours for shops. If the shops have no entry for "friday" (friday hours) then I DONT want that row to be shown in the table, but if there is data there, then i want a new row to be shown. That might not have made too much since but below is my code:

 

$sql = "SELECT Name, open, close, weekday, openf, closef, friday FROM hoursfood ORDER BY Name";

$dbq = mysql_query($sql,$dbh);

 

echo "<TABLE align = center class=hours frame = hsides rules = rows cellpadding = 10>";

while ($row = mysql_fetch_array($dbq)) {

 

echo "<TR>";

echo "<TD class=padded-hours align=left>".$row{'Name'}."</TD>";

echo "<TD class=padded-hours align=center>".$row{'open'}."</TD>";

echo "<TD class=padded-hours align=center>".$row{'close'}."</TD>";

echo "<TD class=padded-hours align=center>".$row{'weekday'}."</TD>";

echo "</TR>";

 

// Below is the code i want to execute only if there is data in the 'friday' row

 

echo "<TR>";

echo "<TD class=padded-hours align=center>";"</TD>";

echo "<TD class=padded-hours align=center>".$row{'openf'}."</TD>";

echo "<TD class=padded-hours align=center>".$row{'closef'}."</TD>";

echo "<TD class=padded-hours align=center>".$row{'friday'}."</TD>";

echo "</TR>";

}

echo "</TABLE>";

mysql_close($dbh);

 

Any help would be super appreciated. Thanks in advance

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.