This is an old revision of the document!
cacheGetAssoc
syntax
mixed cacheGetAssoc ( mixed $cacheSeconds optional string $sql=falsse optional string[] $bindvars=false optional bool $forceArray=false optional bool $first2Cols=false )
Description
If the first parameter passed is a positive integer, The function searches the query cached for a matching statement to the $sql and bindvars. If the first parameter is an SQL statement, the function executes getAssoc().
The presentation of the returned data can be modified by the variable $ADODB_ASSOC_CASE.
For a detailed description of the SQL and bind parameters passed, see cacheExecute().
In addition it should be noted that the presentation of the returned data is modified by the number of columns requested in the SQL statement and the setting of the optional parameters $forceArray
and $first2Cols
.
Requesting two columns
When 2 columns are requested, the first column becomes the key and the second the value.
/* * DB2 Connection assumed */ $ar = $db->cacheGetAssoc(600,"SELECT ACTNO,ACTDESC FROM ACT"); /* * $ar returns: Array ( [10] => MANAGE/ADVISE [20] => ESTIMATE COST [30] => DEFINE SPECS [40] => LEAD PROGRAM/DESIGN ...... ) */