[FX.php List] Return original & duplicated record

Tim 'Webko' Booth tim at nicheit.com.au
Wed Jan 11 14:39:45 MST 2012


On 12/01/2012, at 1:52 AM, Denis Somar wrote:

> Thanks again!
>
> I'm understanding that now.  My issue is as to how I can retrieve  
> it.  I have one snippet of code that retrieves it in a foreach loop:
>
> foreach($r['data'] as $key=>$searchData){
> 	$recordDetails=explode('.',$key);
> 	$recid=$recordDetails[0];
> }
>
> I understand why the above works, but I don't understand how to get  
> that same info in my primary work loop:
>
> foreach($r['data']as $record) {	
>         // Doing the usual tedium of loops here
>        $record['myfield'][0]
> }

The first is actually creating an array $searchData, the second  
$record, so I think this will work:

foreach($r['data'] as $key=>$searchData){
	$recordDetails=explode('.',$key);
	$recid=$recordDetails[0];
	$searchData['myField'][0];
}

(As it so happens, I tend to use descriptive names for every record  
set anyway - make debugging later a lot easier in my book)

Cheers

T




More information about the FX.php_List mailing list