Пример #1
0
 /**
  * Gets  appointment data based on primary record key "nr".
  * Returns  array or boolean. The returned array has index keys corresponding to fieldnames in the $tabfields array.
  *
  * For example:
  * <code>
  * $row=$obj->getAppointment(155);
  * echo $row['purpose']; # Displays the appointment purpose
  * </code>
  *
  * @param int Record number
  * @return mixed
  */
 function getAppointment($nr)
 {
     global $db;
     if (empty($nr)) {
         return false;
     }
     if ($this->result = $db->Execute("SELECT * FROM {$this->tb_appt} WHERE nr={$nr}")) {
         if ($this->result->RecordCount()) {
             return $this->result->FetchRow();
         } else {
             return false;
         }
     }
 }
Пример #2
0
/**
 * Utility function used by the following 3 methods.
 *
 * @param object $rs an ADODB RecordSet object with two columns.
 * @return mixed an associative array, or false if an error occured or the RecordSet was empty.
 * @access private
 */
function recordset_to_menu($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;
    }
}
Пример #3
0
 /**
  * CountRows
  * Returns the number of rows in a result
  * @param object $result
  * @access public
  * @return int
  */
 public function CountRows($result)
 {
     return (int) $result->RecordCount();
 }
Пример #4
0
 /**
  * Returns amount of lines in result.
  *
  * @return integer
  */
 public function RecordCount()
 {
     return $this->res->RecordCount();
 }