motleycrewl Posted March 4, 2008 Share Posted March 4, 2008 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 Quote Link to comment Share on other sites More sharing options...
fenway Posted March 4, 2008 Share Posted March 4, 2008 You need to check the value of the "friday" field... ugh... but this is not a mysql issue. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.