I dont really know how to explain it better, but basically i was wondering if there was some proper way to set a variable to the result of a if statement:

PHP Code:
$blahblah = (if ($orders_history->RecordCount() > 0) {
      while (!
$orders_history->EOF) {
        echo 
'          <tr>' "\n" .
             
'            <td class="smallText" align="center">' zen_datetime_short($orders_history->fields['date_added']) . '</td>' "\n" .
             
'            <td class="smallText" align="center">';
        if (
$orders_history->fields['customer_notified'] == '1') {
          echo 
zen_image(DIR_WS_ICONS 'tick.gif'ICON_TICK) . "</td>\n";
        } else {
          echo 
zen_image(DIR_WS_ICONS 'cross.gif'ICON_CROSS) . "</td>\n";
        }
        echo 
'            <td class="smallText">' $orders_status_array[$orders_history->fields['orders_status_id']] . '</td>' "\n";
        echo 
'            <td class="smallText">' nl2br(zen_db_output($orders_history->fields['comments'])) . '&nbsp;</td>' "\n" .
             
'          </tr>' "\n";
        
$orders_history->MoveNext();
      }
    } else {
        echo 
'          <tr>' "\n" .
             
'            <td class="smallText" colspan="5">' TEXT_NO_ORDER_HISTORY '</td>' "\n" .
             
'          </tr>' "\n";
    }
); 
I'd like blahblah to equal the resulting table of the logic inside of it. Obviously the way I have it shown doesn't work. but how could i get the resulting created table structure as a string for my variable?