So, take a look at what's below and see how it works for you. <?php $get_cs = " SELECT DISTINCT `request_type`, `card_id`, `first_name`, `last_name` FROM `support_payment_request` WHERE `card_id` = '{$id}'"; $cs_type = mssql_query($get_cs) or die(mssql_get_last_message()); $cs_num = mssql_num_rows($cs_type); while ($cs_row = mssql_fetch_array($cs_type)) { $cs[cs_row['card_id']] = $cs_row; print_r($cs_row); } $get_tr = " SELECT DISTINCT `request_type`, `card_id`, `first_name`, `last_name` FROM `payment_request` WHERE `card_id` = '{$id}'"; $tr_type = mssql_query($get_tr) or die(mssql_get_last_message()); $tr_num = mssql_num_rows($tr_type); while ($tr_row = mssql_fetch_array($tr_type)) { $tr[$tr_row['card_id']] = $tr_row; print_r($tr_row); } $num_total = $cs_num + $tr_num; $multiple = "MULTIPLE"; ?> <?php foreach ($id_set as $id) { echo "ID: {$id}"; echo "cs: " . print_r($cs[$id]); echo "tr: " . print_r($tr[$id]); } ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php