当前位置: 首页>>代码示例>>PHP>>正文


PHP MySQLDatabase::escapeVal方法代码示例

本文整理汇总了PHP中MySQLDatabase::escapeVal方法的典型用法代码示例。如果您正苦于以下问题:PHP MySQLDatabase::escapeVal方法的具体用法?PHP MySQLDatabase::escapeVal怎么用?PHP MySQLDatabase::escapeVal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MySQLDatabase的用法示例。


在下文中一共展示了MySQLDatabase::escapeVal方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addTicket

 /**
  * Add new ticket into database.
  *
  * @access	public
  * @param	int	Selected urgency.
  * @param	int	Selected category.
  * @param	string	Subject of the ticket.
  * @param	string	Content of the ticket.
  */
 public function addTicket($urgency, $services, $subject = "", $content = "")
 {
     if ($this->validator->required($urgency, $services, $subject, $content)) {
         $query1 = $this->chkTicketExistance("table", "ts_ticket_topic", "subject", $subject);
         $query2 = $this->chkTicketExistance("table", "ts_ticket_topic", "content", $content);
         if (!$query1 && !$query2) {
             // Later user method whoIsFromStaff
             $this->db->query("\n\t\t\t\t\tINSERT INTO ts_ticket_topic(\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tauthor_id,\n\t\t\t\t\t\trecepient_id,\n\t\t\t\t\t\tsubject,\n\t\t\t\t\t\tdate_time,\n\t\t\t\t\t\tcategory_id,\n\t\t\t\t\t\tpriority_id,\n\t\t\t\t\t\tstatus_id,\n\t\t\t\t\t\tcontent,\n\t\t\t\t\t\tuser_ip\n\t\t\t\t\t) VALUES(\n\t\t\t\t\t\tNULL,\n\t\t\t\t\t\t" . $this->db->escapeVal($_SESSION['id']) . ",\n\t\t\t\t\t\t1,\n\t\t\t\t\t\t'" . $this->db->escapeVal($subject) . "',\n\t\t\t\t\t\tNOW(),\n\t\t\t\t\t\t" . $this->db->escapeVal($services) . ",\n\t\t\t\t\t\t" . $this->db->escapeVal($urgency) . ",\n\t\t\t\t\t\t1,\n\t\t\t\t\t\t'" . $this->db->escapeVal($this->validator->eliminateTags($content)) . "',\n\t\t\t\t\t\t'" . $this->db->escapeVal($_SERVER['REMOTE_ADDR']) . "'\n\t\t\t\t\t)\n\t\t\t\t");
         }
     }
     header("Location: / ");
 }
开发者ID:jahanzaibbahadur,项目名称:Ticket-System,代码行数:21,代码来源:Ticket.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: 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::escapeVal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。