v1.3.9c

I am trying to display customer fields on my invoices and cannot figure out what I'm doing wrong.

I want to display the "Customer ID#" that was automatically generated when the customer registered as well as a custom field I created in the Customer's table with another ID code.

I need to call the fields from another table and then display them based on the order the invoice is generated from.


From another thread, I got this far. But I keep getting an error "Parse error: syntax error, unexpected T_INT_CAST in /.../admin/invoice.php on line 89" My line 89 is:
PHP Code:
where customers_id '" (int)$order_check->fields['customers_id'] . "'"); 
/admin/invoice.php

PHP Code:
$order_customers $db->Execute("select customers_dealercode, customers_dealertype
from " 
TABLE_CUSTOMERS "
where customers_id = '" 
(int)$order_check->fields['customers_id'] . "'"); 
and also added

PHP Code:
 <tr> 
          <td class="main"><b><?php echo 'Customer ID#:'?></b></td>
        <td class="main"><?php echo $order_customers->fields['customer_id']; ?></td>
      </tr>
      <tr>
        <td class="main"><b><?php echo 'Dealer Code/Chargeback Code:'?></b></td>
        <td class="main"><?php echo $order_customers->fields['customer_dealercode']; ?></td>
      </tr>
I can get the "Customer ID#" and "Dealer Code" to display fine when I don't include the db execute, but then there is no data generated next to the field name.

Clearly, I'm not executing something correctly when I'm calling the data from the db. But I'm lost... There aren't any other threads that address this type of customizing and I'm no php expert.

What am I doing wrong? Is there another file I need to edit? Is it the naming of the db execute? Any help will be greatly appreciated.

Thank you