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

Dale Bengston dbengston at preservationstudio.com
Mon Aug 21 15:42:49 MDT 2006


Hi,

Sorry, offline in meetings all day.

If you need to capture the offset of each record in the FX data  
array, you can just set a counter...

$counter = 0;
foreach($searchResult['data'] as $key => $value)
	{
	[...steps to write your list...]

	$counter ++;
	}

Any reference to the counter (above the increments it) is the current  
"offset" in the FX data array.

Dale


On Aug 21, 2006, at 12:53 PM, Jonathan Schwartz wrote:

> 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
>
> _______________________________________________
> 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