[FX.php List] Conditional value lists with PHP and FileMaker

Gjermund Gusland Thorsen ggt667 at gmail.com
Wed Nov 19 16:51:52 MST 2008


I assume this is all you need:

$q = new FX( 'IP_ADDRESS', 80 );
$q->SetDBData( 'DATABASE.fp7', 'LAYOUT', 'all' );
$q->SetDBPassword( 'webpass', 'webuser' );
$q->addDBParam( 'distnum', '*', 'eq' );
$q->addSortParam( 'distnum', 'ascend' );
$r = $dist->FMFind();

foreach( $r['data'] as $k=>$v ) {
	$_SESSION['project']['vlArrayDistrict'][$value['dist_Num'][0]] =
$value['District name'][0];
	$_SESSION['project']['vlArrayCampus'][$value['dist_Num'][0]][$value['schoolID'][0]]
= $value['schoolName'][0];
}

print_r( $_SESSION['project'] );

Please paste the output from the code above on pastebin with no coloring

ggt

2008/11/20 Gjermund Gusland Thorsen <ggt667 at gmail.com>:
> I would like to see the output from:
>
> print_r( $distResult['data'] );
>
> for at least 2 districts
>
> ggt
>
> 2008/11/20 Anders Monsen <andersm at alamark.com>:
>> Yep, from the code it should have worked out that way, and once I added the
>> [0] so the value appeared and not Array, then it worked as planned.
>>
>> Thanks,
>> Anders
>>
>>
>> On Nov 19, 2008, at 4:41 PM, Tim 'Webko' Booth wrote:
>>
>>>>
>>>>
>>>> However, because the values are not unique in the table, the value list
>>>> is showing up with multiple values for the same district. I may need to see
>>>> if I can get the FileMaker database re-structured to eliminate the duplicate
>>>> values in the current table. I think the complicated way I created the array
>>>> previously filtered it for unique values only.
>>>
>>> If you've sorted the results, then you can compare the previous value to
>>> the next to see if it should be written into the drop-down. This is example
>>> from one one of my systems with the same issue (well, it's actually
>>> deliberate in this one, as I'm getting a drop-down of available lengths
>>> compared to diameters)
>>>
>>>                $lengthDupe = "";
>>>                foreach ($thelengthData as $key => $value) {
>>>                        if ($value['Length_mm'][0] != $lengthDupe) {
>>>                                $lengthOut .= '<option
>>> value="'.$value['Length_mm'][0].'">'.$value['Length_mm'][0].' mm</option>';
>>>                                $lengthDupe = $value['Length_mm'][0];
>>>                        }
>>>                }
>>>
>>> Also, I've done something very similar at
>>> http://www.pleatco.com/search/search.php (which is where the code above is
>>> from) for the Dimensions search - I use LAJAX for the call on the fly. Let
>>> me know if you want more info about that technique.
>>>
>>> Cheers
>>>
>>> Webko
>>> _______________________________________________
>>> 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