I’ve spent HOURS on this and I can’t figure it out. My while loop below returns the same record (Sub-Total? three times. Please see the image below for my table structure. Also, this is in an OsCommerce installation, so the “tep_…..” functions are an OsCommerce thing. I don’t believe they’re the problem though because I’ve tried a few other non-OsCommerce solutions here.
[code=php]
$ot_query = tep_db_query(“select * from ” . TABLE_ORDERS_TOTAL . ” where orders_id = ‘” . (int) $order_id . “‘”);
if (tep_db_num_rows($ot_query)) {
while ($ot = tep_db_fetch_array($ot_query)) {
$order_total_sql = tep_db_query(“select * from ” . TABLE_ORDERS_TOTAL . ” where orders_id = ‘” . (int) $order_id . “‘”);
$order_total_result = tep_db_fetch_array($order_total_sql);
$email_order .= strip_tags($order_total_result[‘title’]) . ‘ ‘ . strip_tags($order_total_result[‘text’]) . “n”;
}
}
See the attached image for the table structure. See how there are three different rows that have the same orders_id, but different orders_total_id’s and of course the other data is different as well.