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

Steve St-Laurent st-laur at telus.net
Thu Jul 31 14:28:31 MDT 2008


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>




More information about the FX.php_List mailing list