Hi short_query_caching is referenced only once more in the script: if( $query_logging ) do_log("query.log",$PHP_SELF." - ".$q); if (preg_match('/^\s*delete/i', $q)) { $p = $query_db_handle->prepare($q); if (DB::isError($p) && $die_on_error ) { die ("PREPARE:\n".$q . "\n<br>\n" . $p->getMessage() . "\n<br>\n" . $p->getCode()); } $db_res = $query_db_handle->execute($p); if (DB::isError($db_res) && $die_on_error ) { die ("EXECUTE:\n".$q . "\n<br>\n" . $db_res->getMessage() . "\n<br>\n" . $db_res->getCode()); } } else { $db_res = $query_db_handle->query($q); if (DB::isError($db_res) && $die_on_error ) { die ($q . "\n<br>\n" . $db_res->getMessage() . "\n<br>\n" . $db_res->getCode()); } } // Let's cache all single row results and serve those cached values, if // the query string matches exaclty. if( $short_query_caching && is_object($db_res) && $db_res->numRows() == 1 && strlen($q) <= 80) { //do_log("query.log","$PHP_SELF - CACHED $q"); $short_query_cache[str_replace(" ","",$q)] = $db_res ; // print "<br>"; } return $db_res; } Michael On Jul 19, 2011, at 3:05 AM, Dr Michael Daly wrote: > Hi > is there a simple solution here, other than reverting to php4? > An upgrade from php5 to php5 has resulted in an error msg in this > line: > > if( strlen($db_res ) > 0 ) { > > I understand this is bec. php5 is object orientated. It says an > Object of class DB_result could not be converted to a string > > > This is the full function: > > > function pbcs_db_query( $q , $die_on_error=true, $ext_db_handle="" ) { > global $db_handle; > global $db_res; > global $query_logging,$PHP_SELF; > global $short_query_cache,$short_query_caching; > > if( $ext_db_handle == "" ) > $query_db_handle = $db_handle; > else > $query_db_handle = $ext_db_handle; > > if( $short_query_caching && strlen( $q ) < 80 ) { > $db_res = $short_query_cache[str_replace(" ","",$q)]; > if( strlen($db_res ) > 0 ) { > //do_log("object.log","READ: ".$db_res); > // $db_res->resetResultSet( 0 ); > mysql_data_seek( $db_res->result , 0 ); > //do_log("query.log",$PHP_SELF." - FROM-CACHE - ".$q); > > return $db_res; > } > } What does short_query_cache[] contain? Dr Michael Daly MB, BS GradDip(Integrative Medicine), GradCert(Evidence Based Practice), M Bus(Information Innovation), GradDip(Document Management) 03 9521 0352 0413 879 029 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php