[FX.php List] Re: Suppressing zero values and sorting an array

Gjermund Gusland Thorsen ggt667 at gmail.com
Sat Aug 2 02:26:29 MDT 2008


Tried this:

number_format( floatval( $value['OptionCost'][0] ), 2 )

ggt

2008/8/2 Steve St-Laurent <st-laur at telus.net>:
>
> Thanks, Nick and Germund. No luck yet with either, but I'm quite new to this
> and will have to figure out how to nest the number_format function along
> with one of these suggestions.
>
> In the case of zero-value numbers, I also need to omit this: ' - $'.
>
> But there are only so many combination, so I'll plug away. Thanks!
>
>> Date: Fri, 1 Aug 2008 08:57:00 +0200
>> From: "Gjermund Gusland Thorsen" <ggt667 at gmail.com>
>> Subject: Re: [FX.php List] Suppressing zero values and sorting an array
>>
>> floatval($value['OptionCost'][0])) will make empty 0
>>
>> ggt
>>
>> 2008/8/1 Nick <whatdoyouwant at gmail.com>:
>>>
>>> in php use an if (!empty($value['OptionCost'][0])) {
>>> // display stuff
>>> }
>>>
>>> if i understand you correctly about the hiding numbers that are 0
>>>
>>> On Thu, Jul 31, 2008 at 4:07 PM, Gjermund Gusland Thorsen
>>> <ggt667 at gmail.com>
>>> wrote:
>>>>
>>>> intval()?
>>>>
>>>> ggt
>>>>
>>>> 2008/7/31 Steve St-Laurent <st-laur at telus.net>:
>>>>>
>>>>> I am trying to suppressing zero values in the display of number fields
>>>>> pulled from a Filemaker field. The number_format function won't do it,
>>>>> as
>>>>> far as I can tell, and formatting the number in Filemaker to not
>>>>> display
>>>>> if
>>>>> zero has no effect.
>>>>>
>>>>> Ideally, it would be great also if I could sort items in events_list.
>>>>>
>>>>> Here's the original:
>>>>>
>>>>> <?
>>>>> $events_list = "";
>>>>> if (array_key_exists('Choice',$_POST)) {
>>>>>  foreach($_POST['Choice'] as $choice) {
>>>>>   $parent_event_id = substr($choice,0,strpos($choice," - "));
>>>>>       $event_name = substr($choice,strpos($choice," - ") + 3);
>>>>>
>>>>>       $Options = new FX(FMIP, FMWCPort);
>>>>>   $Options->SetDBData(Database, 'EventOptions');
>>>>>   $Options->SetDBUserPass(User,Password);
>>>>>   $Options->AddDBParam('ActiveCalc', "Active");
>>>>>   $Options->AddDBParam('EventRecordID', $parent_event_id);
>>>>>   $OptionsData = $Options->FMFind();
>>>>>
>>>>>       $events_list .= "<input type=\"hidden\" name=\"EventID\"
>>>>> value=\"" .
>>>>> $parent_event_id . "\">";
>>>>>
>>>>>       if ($OptionsData['foundCount'] > 0) {
>>>>>         $events_list .= "<B>" . $event_name . "</B><hr><br>";
>>>>>         foreach ($OptionsData['data'] as $key => $value) {
>>>>>           $events_list .= "<input type=\"checkbox\" name=\"Choice_" .
>>>>> $value['UniqueID'][0] . "\" value=\"" . $value['UniqueID'][0] .
>>>>> "\">&nbsp;"
>>>>> . $value['OptionName'][0] . ' - $'.
>>>>> number_format($value['OptionCost'][0],2)
>>>>> . "<br>";
>>>>>         }
>>>>>       }
>>>>>  }
>>>>> }
>>>>> ?>
>>>>>
>>>>> Any suggestions or pointers? Thanks!
>
> -------------
> Steve St-Laurent  |  <steve at holecomm.ca>
> Hole-in-the-Wall Communications | Vancouver BC | 604 251 0700
>
>
> _______________________________________________
> 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