[FX.php List] Summary of Records
Gareth Evans
gareth.evans at schawk.com
Mon Dec 8 11:15:46 MST 2008
This is one way of doing it:
$teamMenu = '<select name="team">';
foreach ($uniqueList as $ulk=>$ulv) {
$teamMenu .= '<option value="'.$ulk.'">'.$ulv.'</option>';
}
$teamMenu .= '</select>';
echo $teamMenu;
--
GARETH EVANS
> From: "william.downs" <william.downs at gmail.com>
> Reply-To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>
> Date: Mon, 8 Dec 2008 18:10:04 +0000
> To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>
> Subject: Re: [FX.php List] Summary of Records
>
> Hi Anders (and Co)
>
> i like the array_unique() - just what I needed.
>
> Now I need to turn $uniqueList into a select (html drop down)
>
> Any idea how that could be done ?
>
> Kindest Regards
>
> William
>
> On 8 Dec 2008, at 15:41, Anders Monsen wrote:
>
> How about array_unique?
>
> $theList = array('Team1','Team1','Team2','Team3','Team1','Team2' );
> $uniqueList = array_unique($theList);
> sort($uniqueLists);
>
> Anders
>
> On Dec 8, 2008, at 9:35 AM, Steve Winter wrote:
>
>> Hi William,
>>
>> You could go with something like this;
>>
>> $uniqueList = array()
>>
>> foreach($teamList as $team) {
>> if(!in_array($team, $uniqueList) {
>> $uniqueList[] = $team;
>> }
>> }
>>
>> Then $uniqueArray will have only one entry for each $team. You may
>> also then want to do a sort on that array prior to output in case
>> the data that it received was
>>
>> Team3
>> Team1
>> Team3
>> Team2
>>
>> Cheers
>> Steve
>>
>>
>>
>>
>> On 8 Dec 2008, at 15:05, william.downs wrote:
>>
>>>
>>> Hi there List,
>>>
>>> If an array was to return more than one record, and a value was
>>> repeated, how do I strip out the individual values ?
>>>
>>> Example :
>>>
>>> If the returned values were
>>>
>>> Team1
>>> Team2
>>> Team1
>>> Team3
>>> Team1
>>>
>>> I would ONLY want to see
>>> Team1
>>> Team2
>>> Team3
>>>
>>> In Filemaker, I could create a value list, or a sub-summary list,
>>> and this would give me the individual records.
>>>
>>>
>>> Kindest Regards
>>>
>>> William
>>> _______________________________________________
>>> FX.php_List mailing list
>>> FX.php_List at mail.iviking.org
>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>
>>
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>
>>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
More information about the FX.php_List
mailing list