[FX.php List] Getting "-recid" for 1 record

Andrew Denman adenman at tmea.org
Tue Jul 18 11:52:26 MDT 2006


Don't remember where I found this, but it's useful if you only have one
record returned. The first line will give you the key and data of the first
set of data in the $ResultAll['data'] array (and according to the php docs,
advance the pointer to the next set of data).  Second and third lines will
break out the recid and modid.

list($key, $data) = each($ResultAll['data']);
$recid = strtok($key, ".");
$modid = strtok(".");
$Field_Data = $data['Field_Name'][0];

If you just want the key I believe this will work, but I haven't tried:
list($key) = each($ResultAll['data']);
$recid = strtok($key, ".");
$modid = strtok(".");

Andrew Denman

-----Original Message-----
From: fx.php_list-bounces at mail.iviking.org
[mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of AC
Sent: Tuesday, July 18, 2006 12:30 PM
To: fx.php_list at mail.iviking.org
Subject: [FX.php List] Getting "-recid" for 1 record

If I know that only 1 record is returned then I can use the following 
to get data from that record;

$ResultAll=$Search->FMEdit();
$ResultOne=current($ResultAll['data']);
echo('ID=' . $ResultOne['ID'][0]);



How would I do the same thing to get the "-recid" without doing the 
following loop thing?

foreach($ResultAll['data'] as $key=>$ResultOne){
    $TheRecIDModNum=explode('.',$key);
    $TheRecID=$TheRecIDModNum[0];
}

_______________________________________________
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