[FX.php List] modid, recid, and single record search results

DC dan.cynosure at dbmscan.com
Wed Dec 12 14:24:07 MST 2007


note, this code provided by ggt below only gets you the $recid and the 
$modid while the original question was about getting the record data 
itself.

while you could use this technique to subsequently get the data in the 
next line, it is much more direct to just use current() ( or each() ) to 
get a single array *value* from the FX array's 'data' element without 
knowing the explicit key and without using a foreach().

dan

Gjermund Gusland Thorsen had written:
> This is the way I plan on putting in the FX.php addendum I work on at the moment
> ---
> list( $recid, $modid ) = explode( '.', key( $queryResult['data'] ) );
> ---
> ggt
> 
> 2007/12/12, Dale Bengston <dbengston at preservationstudio.com>:
>> Hi Jamie,
>>
>> If you have one record (and you can find out by looking at foundCount, you
>> can get past "knowing" the recid and the modid with something like this:
>>
>> if ($returnedData['foundCount'] == 1)
>>  {
>>  $theRec = current($returnedData['data']);
>>  }
>>
>> For more on the use of current() on arrays, take a look at
>>
>> http://us2.php.net/manual/en/function.current.php
>>
>> Hope this helps,
>> Dale
>>
>>
>>
>> On Dec 12, 2007, at 12:45 PM, Jamie Adams wrote:
>>
>>
>> Hello all,
>>
>> I have a script that pulls data on individual records.  It does a search for
>> the records primary key value in the primary key field.  And with any luck,
>> finds one and only one record.  So my FMFind() returns an array with all the
>> usual stuff, and my single, solitary record, to my $ReturnedData array.  So
>> I should be able to get my data in ReturnedData['data'], but I have to
>> specify and record ID and a mod ID.  I assume since there's only one record
>> in my found set, my RecID is either 0 or 1.  But what's my ModID?  I'm not
>> making any changes, so I just want the most current version.
>>
>> When I have multiple records returned, I do a foreach($ReturnedData['data']
>> as $key=>$searchData), and then use $searchData as my array of search
>> results.  That works, but I never really understood why.  And it seems
>> wasteful and inefficient to use the foreach() when I only have 1 record.  Is
>> there another way?
>>
>> Jamie Adams
>> ________________________________________________________
>>
>> Liquis, Inc.
>>
>> 400 Parker Drive, Suite 1110, Austin, TX 78728
>> phone 512.299.9634, ext 103 -- fax 512.873.0575
>> ________________________________________________________
>>
>> www.liquis.com
>> www.auctionpartner.com
>> www.furniture-partner.com
>> eBay Store:
>> http://stores.ebay.com/Auction-Partner-High-Tech-Equipment?refid=store_______________________________________________
>> 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
>>
>>
> _______________________________________________
> 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