Beginner Help - Array
| From: | P. Guethlein | Date: | Thu, 13 Apr 2006 20:51:21 +0000 |
| Subject: | Beginner Help - Array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-233942@lists.php.net to get a copy of this message | ||
This seems like it should work, but the option statement is just filling in one line of data....hmmmmm... the names have multiple territories (ID's), so I want to have one name associated with one territory ID ( other stuff happens elseware...).
//building list of names and their territory matching ID's
while($getidsd = mysql_fetch_array($getidsr)){
if ($getidsd['employeeid'] != '990'&& $getidsd['employeeid'] != '991') {
$salespersonsstor= Array("name"=>$getidsd['fname'].' '.$getidsd['lname'],"idIS"=>$getidsd['employeeid']);
}
}
asort($salespersonsstor);
$salesmanactive='';
$salesmann='';
$ID1='';
foreach ($salespersonsstor as $key => $TheSalesManID) {
switch ($key) {
case "name":
$salesmann = $TheSalesManID;
break;
case "idIS":
$ID1 = $TheSalesManID;
}
If (($salesmann != '' && $ID1 != '') && ($salesmanactive != $salesmann)) {
echo '<option value="'.$ID1.'">'.$salesmann.'</option>';
$salesmanactive=$salesmann;
$salesmann='';
$ID1='';
}
}