[FX.php List] Pulling data directly from findResult

Jonathan Schwartz jschwartz at exit445.com
Thu Oct 16 09:45:27 MDT 2008


Want to display one record at a time from found set.
Is there a better way to approach this?

I don't see the difference between the two examples below that would 
cause records 1 to echo on the first line and then record 2 to 
display in the second.  Does "key" automatically increment itself?

In any event, I just want to be able to start at the first and then 
manually walk to the next, etc.

I expect to use a counter.

J

At 11:20 AM -0400 10/16/08, Gareth Evans wrote:
>Here's one way to manually step through the result array using each().
>
>//record 1
>$rec = each($findResult['data']);
>echo $findResult['data'][$rec['key']]['desiredfieldname'][0];
>
>// record 2
>$rec = each($findResult['data']);
>echo $findResult['data'][$rec['key']]['desiredfieldname'][0];
>
>Don't know why you wouldn't want to use a loop of some sort though...
>--
>GARETH EVANS
>
>
>>  From: Jonathan Schwartz <jschwartz at exit445.com>
>>  Reply-To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>
>>  Date: Thu, 16 Oct 2008 08:02:34 -0700
>>  To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>
>>  Subject: Re: [FX.php List] Pulling data directly from findResult
>>
>>  Great!  That seems to retrieve the first one.  How do I call others
>>  in the array?
>>
>>  J
>>
>>  At 4:43 PM +0200 10/16/08, Gjermund Gusland Thorsen wrote:
>>>  echo $findResult['data'][key($findResult['data'])]['desiredfieldname'][0];
>>>
>>>  ggt
>>>
>>>  2008/10/16 Jonathan Schwartz <jschwartz at exit445.com>:
>>>>   Hi Foks,
>>>>
>>>>   Instead of using foreach, how can data be pulled from the $FindResult
>>>>  array?
>>>>
>>>>   Trying syntax such as this, without result:
>>>>
>>>>   $desireddatavalue = $findResult['data'] ['desiredfieldname']
>>>>
>>>>   I know it's not right.  I'm just missing that last syntax 
>>>>step....I think.
>>>>
>>>>   Assume that I want to manually step through found records, string with
>>>>   first.
>>>>
>>>>   Thanks
>>>>
>>>>   Jonathan
>>>>
>>>>   --
>>>>   Jonathan Schwartz
>>>>   Exit 445 Group
>>>>   jonathan at exit445.com
>>>>   http://www.exit445.com
>>>>   415-370-5011
>>>>   _______________________________________________
>>>>   FX.php_List mailing list
>>>>   FX.php_List at mail.iviking.org
>>>>   http://www.iviking.org/mailman/listinfo/fx.php_list
>>>>
>>>  _______________________________________________
>>>  FX.php_List mailing list
>>>  FX.php_List at mail.iviking.org
>>>  http://www.iviking.org/mailman/listinfo/fx.php_list
>>
>>
>>  --
>>  Jonathan Schwartz
>>  Exit 445 Group
>>  jonathan at exit445.com
>>  http://www.exit445.com
>>  415-370-5011
>>  _______________________________________________
>>  FX.php_List mailing list
>>  FX.php_List at mail.iviking.org
>>  http://www.iviking.org/mailman/listinfo/fx.php_list
>
>_______________________________________________
>FX.php_List mailing list
>FX.php_List at mail.iviking.org
>http://www.iviking.org/mailman/listinfo/fx.php_list


-- 
Jonathan Schwartz
Exit 445 Group
jonathan at exit445.com
http://www.exit445.com
415-370-5011


More information about the FX.php_List mailing list