[FX.php List] Self-relationship
Anthony Talo
alatalo at chartermi.net
Thu Sep 29 07:38:07 MDT 2005
Hello List,
Thanks to all of you who have put so much time into this project, esp.
Chris and Gjermund...
The FM7 db I'm using has a self-relationship portal. I can display the
data fine when there is one item in the portal but I can't get PHP to
loop through all the items in the portal. I'm new to PHP and did this
originally in XSLT.
$search_result = new FX($serverIP,$webCompanionPort);
$c_recordInternalID = $_GET[c_recordInternalID]; #from the request URL
$search_result->SetDBData($databaseFile,$queryLayout,$groupSize);
$search_result->AddDBParam("-recid","$c_recordInternalID");
$recordData = $search_result->FMFind();
<?php if ($recordData['foundCount']==0) { ?>
<tr>
<td><p>There were no matches for your request.</p></td>
</tr>
<?php }else{ ?>
<?php foreach ($recordData['data'] as $recordKey=>$recordData) { ?>
#this works fine - the portal for the self-relationship only has one
value
<tr>
<td class="rwrt">Image Class:</td>
<td class="rw">
<?php if($recordData['Image_Class'][0]== 'Primary') { ?>
<span class="rdb">Primary </span>Image for Stock Number:
<span class="b"><?php echo $recordData['Stock_NumberMFG'][0];?></span>
<?php }else{ ?>
<span class="rdb">Secondary </span>Image for Stock Number:
<span class="b"><?php echo
$recordData['SELF_Primage::Stock_NumberMFG'][0];?></span>
<?php }?>
</td>
</tr>
<tr>
<td class="rwltcl"><b>Stock Number: </b></td>
<td class="rwltcl">
<?php echo $recordData['Stock_Number'][0]; ?>
</td>
</tr>
#but this doesn't work
<tr>
<td class="rw">
<span class="b">Secondary Image (s) Assigned:</span>
</td>
<td class="rw">
<span>
<?php echo $recordData['SELF_scimage::Image_Number'][0]; ?>
</span>
</td>
</tr>
<?php } ?>
<?php } ?>
I tried putting it in another foreach loop but it didn't work. Is that
the right approach? If it is, then I'll keep pounding away at my
understanding of PHP. If not, is there a better way? Moving the
self-relat portal to a separate table?
Thanks in advance,
(I'm on digest, so if you could cc my address that'd be helpful)
Cheers,
Tony
More information about the FX.php_List
mailing list