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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.