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

Gjermund Gusland Thorsen ggt667 at gmail.com
Fri Aug 1 00:57:00 MDT 2008


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>
>> >
>> >
>> > _______________________________________________
>> > 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