當前位置: 首頁>>代碼示例>>PHP>>正文


PHP MySQLDatabase::fetchAssoc方法代碼示例

本文整理匯總了PHP中MySQLDatabase::fetchAssoc方法的典型用法代碼示例。如果您正苦於以下問題:PHP MySQLDatabase::fetchAssoc方法的具體用法?PHP MySQLDatabase::fetchAssoc怎麽用?PHP MySQLDatabase::fetchAssoc使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MySQLDatabase的用法示例。


在下文中一共展示了MySQLDatabase::fetchAssoc方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getDataFromDB

 /**
  * Get settings data from DB.
  *
  * @access	private
  * @return	array
  */
 private function getDataFromDB()
 {
     $data = array();
     $query = $this->db->query("\n\t\t\tSELECT setting_name, setting_value\n\t\t\tFROM ts_system_settings\n\t\t\tORDER BY id\n\t\t");
     while (($row = $this->db->fetchAssoc($query)) != NULL) {
         $data[$row['setting_name']] = $row['setting_value'];
     }
     return $data;
 }
開發者ID:jahanzaibbahadur,項目名稱:Ticket-System,代碼行數:15,代碼來源:Cache.php

示例2: getNumPages

 /**
  * Calculate the number of pages.
  *
  * @access	public
  * @return	int
  */
 public function getNumPages()
 {
     if ($this->user->ugroup == 1) {
         $query = "SELECT COUNT(1) AS total FROM ts_tickets_view WHERE status_name = 'Opened'";
         $total = $this->db->fetchAssoc($query);
     } else {
         $query = "SELECT COUNT(1) AS total FROM ts_tickets_view WHERE author_id = " . $this->db->escapeVal($this->user->id);
         $total = $this->db->fetchAssoc($query);
     }
     $this->totalEntryNum = (int) $total['total'];
     $this->numPages = ceil($this->totalEntryNum / $this->entryPerPage);
     return $this->numPages;
 }
開發者ID:jahanzaibbahadur,項目名稱:Ticket-System,代碼行數:19,代碼來源:Pagination.php

示例3: displayCategories

 /**
  * Get all available categories.
  *
  * @access	public
  * @return	array
  */
 public function displayCategories()
 {
     $allCats = $this->db->query("SELECT id, category_name FROM ts_ticket_category ORDER BY id");
     $keys = array();
     $values = array();
     while (($categories = $this->db->fetchAssoc($allCats)) != NULL) {
         //array_push($keys, (int)$categories['id']);
         //array_push($values, $categories['category_name']);
         $keys[] = (int) $categories['id'];
         $values[] = $categories['category_name'];
     }
     return array_combine($keys, $values);
 }
開發者ID:jahanzaibbahadur,項目名稱:Ticket-System,代碼行數:19,代碼來源:Ticket.php

示例4: chkUserExistance

 /**
  * Search for user in database. Check whether user is
  * a numeric value, for example user id or is it an array
  * of user attributes.
  *
  * @access	public
  * @param	int | array
  * @return	array | bool
  */
 public function chkUserExistance($user)
 {
     if (is_numeric($user)) {
         $query = "\n\t\t\t\tSELECT id, username, userpass, email, ugroup\n\t\t\t\tFROM ts_users\n\t\t\t\tWHERE id = " . $this->db->escapeVal($user) . "\n\t\t\t\tLIMIT 1\n\t\t\t";
         return $query;
     } else {
         if (is_array($user)) {
             $query = "\n\t\t\t\tSELECT id, username, userpass, email, ugroup\n\t\t\t\tFROM ts_users\n\t\t\t\tWHERE username = '" . $this->db->escapeVal($user['username']) . "'\n\t\t\t\tOR email = '" . $this->db->escapeVal($user['email']) . "'\n\t\t\t\tLIMIT 1\n\t\t\t";
             # If user not found
             if (!($row = $this->db->fetchAssoc($query))) {
                 return false;
             }
             return true;
         }
     }
 }
開發者ID:jahanzaibbahadur,項目名稱:Ticket-System,代碼行數:25,代碼來源:UserManager.php


注:本文中的MySQLDatabase::fetchAssoc方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。