[FX.php List] Do an "if" on found set ...

VanBuskirk, Patricia pvanbuskirk at fsu.edu
Wed Sep 8 10:30:08 MDT 2010


I have a FMFind as follows (on a user ID, it pulls back lines of items
for that user)

	$userQuery = new FX(FM_IP, FM_PORT, FM_VERSION);
	$userQuery->SetDBData('Webtest_Forms.fp7', 'MS_HG_SERVICES');
	$userQuery->SetDBUserPass(FM_USERNAME, FM_PASSWORD);
	$userQuery->AddDBParam ('USERID', $_SESSION['fsusn'], 'eq');
	$userResult=$userQuery->FMFind();

	foreach($userResult['data'] as $key=>$userData){
	$userDetails=explode('.',$key);
	$userRecord=$userDetails[0];
	}

Then I have each line show in a table as follows, which works great:

	<?php
	if ($_SESSION['found']>0) {     // If user exists

	echo "<table align='center' cellpadding='3' class='bordertable'>
                <tr><td align='center' colspan='4'
class='tableborderheading'>You presently have ".$_SESSION['found']."
service(s):</td></tr>
				<tr valign='bottom'>
					  <td align='left'
class='ColumnHeader'><b>Description</b></td>
					  <td align='center'
class='ColumnHeader'><b>Start Date</b></td>
					  <td align='right'
class='ColumnHeader'><b>Rate</b></td>
				</tr>";

	foreach($userResult['data'] as $key=>$userData){
	$userDetails=explode('.',$key);
	$userRecord=$userDetails[0];

	echo "<tr align='center'>
                  <td align='left'
nowrap>".strtoupper($userData['DESCRIPTION'] [0])."</td>
                  <td align='center'>".$userData['STARTDATE'] [0]."</td>
                  <td align='right'>".$userData['AMOUNT'] [0]."</td>
           </tr>";
	  }
	echo "</table><br>";
	}
	?>

Now what I'd like to do is ... if an item exists, then have the checkbox
be to Remove the item ... if not, it would be to add the item.  What
would the syntax be for something like that?  Do I have to do a find for
each item first?  

I tried the following, but it did not work:

	<?php

		if ($userData['ITEMNO']=='HGCATVHBO') {
			echo "Remove&nbsp;<input name='D_CableService'
type='radio' value='HGCATVHBO'>";
			} else {
			echo "Add&nbsp;<input name='A_CableService'
type='radio' value='HGCATVHBO'>";
			}

	?>


More information about the FX.php_List mailing list