/** * Utility function used by the following 3 methods. * * @param ADORecordSet $rs an ADODB RecordSet object with two columns. * @return mixed an associative array, or false if an error occurred or the RecordSet was empty. * @access private */ function recordset_to_menu(ADORecordSet $rs) { global $CFG; if ($rs && $rs->RecordCount() > 0) { $keys = array_keys($rs->fields); $key0 = $keys[0]; if (isset($keys[1])) { $key1 = $keys[1]; } else { $key1 = $keys[0]; } while (!$rs->EOF) { $menu[$rs->fields[$key0]] = $rs->fields[$key1]; $rs->MoveNext(); } return $menu; } else { return false; } }
/** * Retrieve number of rows returned for a specific database query * @param ADORecordSet $p_result Database Query Record Set to retrieve record count for. * @return int Record Count */ function db_num_rows($p_result) { global $g_db; return $p_result->RecordCount(); }
/** * Number of rows in current result set * * @deprecated use the result-object returned by query/select()->NumRows(), so you can use the global db-object and not a clone * @return int number of rows */ function num_rows() { return $this->Query_ID ? $this->Query_ID->RecordCount() : False; }