Re: Loop issues

From: Date: Fri, 16 Nov 2007 20:03:47 +0000
Subject: Re: Loop issues
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-264723@lists.php.net to get a copy of this message
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]); } ?>

« previous php.general (#264723) next »