[FX.php List] Browsing a set of found records

Jonathan Schwartz jonathan at eschwartz.com
Mon Aug 21 11:53:15 MDT 2006


Another small detail...

My code works fine if/when the user select the first item on the list. Duh.

But, if the users selects a record that is not the first one, I need 
to know what the offset in the array is.

I need to write to a variable, the value of the offset of the record 
that the user selects from a list.

How can you identify the position offset (0, 1, 2...)  in the array 
when using this for each statement:

foreach($searchResult['data'] as $key => $value) {

     	echo "<tr>";
		echo "<td><a href=\"detail.php?recid=";
   	  	$recordDetails=explode('.',$key);
		$currentRecord=$recordDetails[0];
		echo $currentRecord."\">".$value['last1'][0];
   	 	echo "</a></td>";
	  echo "</tr>";

	   }

I've examined the 'data' array and it looks like that position of the 
record in the array is not provided.

Does that mean I need to create and populate it?

All that I can think of is to:
	- capture the recid from the code above.
	- Interrogate the separate Session array iIve created (Same 
number of records), looking for the matching recid and then capturing 
it's offset in that array (which I will need to create and populate 
at the time of array creation)

Seems like a long way to do this.

Thanks

Jonathan
-- 



Jonathan Schwartz
FileMaker 8 Certified  Developer
Associate Member, FileMaker Solutions Alliance
Schwartz & Company
jonathan at eschwartz.com
http://www.eschwartz.com
http://www.exit445.com



More information about the FX.php_List mailing list