/**
  * Method for checking the existance of the ticket.
  *
  * @access	public
  * @param	string	The type of the search request.
  * @param	string	Search request itself.
  * @return	int
  */
 public function chkTicketExistance($type, $tbl_query)
 {
     $argsArray = func_get_args();
     switch ($type) {
         case "query":
             $result = $this->db->numRows($tbl_query);
             break;
         case "table":
             $countArgs = func_num_args() - 2;
             $query = "SELECT * FROM " . $this->db->escapeVal($tbl_query) . " ";
             if (fmod($countArgs, 2) == 0) {
                 $pairsCount = $countArgs / 2;
                 if ($pairsCount == 1) {
                     $value = is_string($argsArray[3]) ? "'" . $argsArray[3] . "'" : $argsArray[3];
                     $whereClause = $argsArray[2] . " = " . $value;
                 } else {
                     $i = 2;
                     $pair = 1;
                     while ($i <= $countArgs) {
                         $whereClause .= $argsArray[$i] . " = ";
                         $i++;
                         $value = is_string($argsArray[$i]) ? "'" . $argsArray[$i] . "'" : $argsArray[$i];
                         $whereClause .= $value;
                         if ($pair != $pairsCount) {
                             $whereClause .= " AND ";
                         }
                         $pair++;
                         $i++;
                     }
                 }
             } else {
                 return false;
             }
             $query .= "WHERE " . $whereClause;
             $result = $this->db->numRows($query);
             break;
     }
     return $result;
 }