aiyou Posted October 21, 2007 Share Posted October 21, 2007 Hello. This is probably more of a generic PHP/HTML how-to question, but here goes... On the Invoice, various order history comments are displayed. I would like to only display those which were marked as 'customer_notified'. I've successfully modified the $orders_history_query to read: $orders_history_query = tep_db_query("select orders_status_id, date_added, comments from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . tep_db_input($oID) . " ' and customer_notified = '1' and length(ltrim(rtrim(comments))) > 0 order by date_added"); My dilema, though, is that I only want to display the resulting HTML table (Date Added, Comments) if my row count is greater than 0. How do I nest the table build syntax <table> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '20'); ?></td> </tr> <tr> <td width="45%" align="left" class="main"> <table border="1" cellspacing="0" cellpadding="3"> <tr> <td class="smallText" align="center"><b><?php echo TABLE_HEADING_DATE_ADDED; ?></b></td> <td class="smallText" align="center"><b><?php echo TABLE_HEADING_COMMENTS; ?></b></td> </tr> into the php block <?php // modified 10/20/07 to exclude internal comments (customer_notified = 0 or where no comment value exists $orders_history_query = tep_db_query("select orders_status_id, date_added, comments from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . tep_db_input($oID) . "' order by date_added"); if (tep_db_num_rows($orders_history_query) > 0) { while ($orders_history = tep_db_fetch_array($orders_history_query)) { // INSERT TABLE HERE // DISPLAY CUSTOMER RECEIVED COMMENTS echo ' <tr>' . "\n" . ' <td class="smallText" align="center">' . tep_datetime_short($orders_history['date_added']) . '</td>' . "\n" . ' <td class="smallText">' . nl2br(tep_db_output($orders_history['comments'])) . ' </td>' . "\n" . ' </tr>' . "\n"; } // DO NOT DISPLAY CONTENTS OF TEXT_NO_ORDER_HISTORY // } else { // echo ' <tr>' . "\n" . // ' <td class="smallText" colspan="5">' . TEXT_NO_ORDER_HISTORY . '</td>' . "\n" . // ' </tr>' . "\n"; } ?> so that nothing displays if no customer-received comments are present? I'd prefer not to display the contents of TEXT_NO_ORDER_HISTORY. Thanks in advance Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.