hello,
I am creating an array that will often have duplicate elements it it because these elemants are common with in many rows.
I need to have only one from each group of these duplicates in my selection box. My code for ceating my selection box is below.
My question is – how do I go about excluding the unwanted rows ?
[code=php]
<?php
$sql = “SELECT account_name,SO_num,prod,SO_date FROM $client_table
WHERE account_type =’S_ORD’ ORDER BY ‘account_name,SO_num,prod'”;
$result = mysql_query($sql)
or die(“Couldn’t execute MAKE CUST LIST query.”);
while( $row = mysql_fetch_assoc( $result ) )
$sal_ord_array[] = $row;
?>
<td class = ‘cb’>
<select name=’sal_ord’>
<?php
foreach( $sal_ord_array) {
if $sal_ord_array[account_name]
foreach( $sal_ord_array as $row1 ) {
echo “<option value = “$row1[account_name]/-/$row1[SO_num]” >$row1[account_name] – $row1[SO_num]</option>”;
}// end foreach loop
?>
</select></td>
This code creates a selection box but there are several lines of $row1[account_name] – $row1[SO_num] that are the same.
How do I just get one of each example ?
?
Thanks for you input.