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


PHP MySQL::condition方法代码示例

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


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

示例1: deleteFrom

 public static function deleteFrom($tableID, $whereArr, $returnTable = NULL)
 {
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $chk = array("bool" => true, 'function' => "deleteFrom");
     //----------------------------------------------------------
     $tableID = GlobalMas::$mysqli->real_escape_string($tableID);
     //----------------------------------------------------------
     $queryString = "DELETE FROM " . $tableID . " ";
     //----------------------------------------------------------
     $queryString = MySQL::condition($tableID, $whereArr, "where", $queryString);
     //----------------------------------------------------------
     $result = GlobalMas::$mysqli->query($queryString);
     //----------------------------------------------------------
     if (GlobalMas::$debug) {
         $chk["queryString"] = $queryString;
     }
     //----------------------------------------------------------
     if ($result) {
         $chk["bool"] = true;
         $chk["message"] = "delete complete";
         if ($returnTable) {
             $chk = call_user_func_array(array(MySQL, "getTable"), array($tableID));
         }
     } else {
         $chk["bool"] = false;
         $chk['error'] = true;
         $chk["message"] = GlobalMas::$mysqli->error(GlobalMas::$mysqli);
     }
     //----------------------------------------------------------
     return $chk;
     //----------------------------------------------------------
 }
开发者ID:awwthentic1234,项目名称:hey,代码行数:34,代码来源:MySQL.php

示例2: getQueryString

 public function getQueryString()
 {
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $chk = array("bool" => true, "traceID" => "getTable");
     //----------------------------------------------------------
     $this->tableID = Constants::$mysqli->real_escape_string($this->tableID);
     //----------------------------------------------------------
     $queryString = "SELECT " . $this->tableID . ".*";
     $queryString .= " FROM " . $this->tableID;
     //----------------------------------------------------------
     if (!is_null($this->whereArr)) {
         $queryString = MySQL::condition($this->tableID, $this->whereArr, "where", $queryString);
     }
     //----------------------------------------------------------
     return $queryString;
 }
开发者ID:awwthentic1234,项目名称:hey,代码行数:18,代码来源:GetTable.php

示例3: update

 public function update()
 {
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $chk = array("bool" => true, 'function' => "update");
     //----------------------------------------------------------
     $this->tableID = GlobalMas::$mysqli->real_escape_string($this->tableID);
     //----------------------------------------------------------
     $this->queryString = "UPDATE " . $this->tableID . " ";
     //----------------------------------------------------------
     $this->queryString = MySQL::condition($this->tableID, $this->setArr, "set", $this->queryString);
     $this->queryString = MySQL::condition($this->tableID, $this->whereArr, "where", $this->queryString);
     //----------------------------------------------------------
     $chk = $this->getResult();
     //----------------------------------------------------------
     if ($this->returnTable) {
         $chk = GetTable::go($this->tableID, $this->whereArr);
     }
     //----------------------------------------------------------
     return $chk;
     //----------------------------------------------------------
 }
开发者ID:awwthentic1234,项目名称:hey,代码行数:23,代码来源:Update.php

示例4: insertINTO

 public function insertINTO()
 {
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $chk = array("bool" => true, 'function' => "insertINTO");
     $this->updateArr = array();
     //----------------------------------------------------------
     $chk = GenFun::errorKey_chk($this->setArr, NULL, true);
     //----------------------------------------------------------
     $this->setArr = $chk['valueArr'];
     //----------------------------------------------------------
     if (!$chk['bool']) {
         return $chk;
     }
     //----------------------------------------------------------
     $this->tableID = Constants::$mysqli->real_escape_string($this->tableID);
     //----------------------------------------------------------
     $this->queryString = $this->insertType . " " . $this->tableID . " (";
     foreach ($this->setArr as $i => $value) {
         if (strrpos($value, "{hash}") === 0) {
             $this->updateArr[$i] = $value;
         } else {
             $this->queryString .= $i . ",";
         }
     }
     //----------------------------------------------------------
     foreach ($this->updateArr as $i => $value) {
         unset($this->setArr[$i]);
     }
     //----------------------------------------------------------
     $this->queryString = substr($this->queryString, 0, -1);
     $this->queryString .= ") ";
     //----------------------------------------------------------
     $keys = array_keys($this->setArr);
     $this->queryString .= "VALUES ";
     //----------------------------------------------------------
     $high = sizeof($this->setArr[$keys[0]]);
     for ($i = 1; $i < sizeof($this->setArr); $i++) {
         if (is_array($this->setArr[$keys[$i]])) {
             $cur = sizeof($this->setArr[$keys[$i]]);
             if ($high < $cur) {
                 $high = $cur;
             }
         }
     }
     //----------------------------------------------------------
     for ($i = 0; $i < 1; $i++) {
         $value = $this->setArr[$keys[$i]];
         $num = is_array($value) ? sizeof($value) : 1;
         for ($j = 0; $j < $high; $j++) {
             if (is_array($this->setArr[$keys[$i]])) {
                 $value = $this->setArr[$keys[$i]][$j];
             }
             if ($i == 0) {
                 $this->queryString .= "(";
             }
             if (strrpos($value, "(") !== false && strrpos($value, "(") == 0 && !$this->ignore) {
                 $this->queryString .= $value;
                 //$this->queryString .= ",";
             } else {
                 if ($value == "DEFAULT") {
                     $this->queryString .= $value;
                 } else {
                     $this->queryString .= "'" . Constants::$mysqli->escape_string($value) . "'";
                 }
             }
             //-------------------------------------------------
             for ($k = 0; $k < sizeof($this->setArr); $k++) {
                 if ($keys[$k] != $keys[$i]) {
                     $this->queryString .= ",";
                     if (is_array($this->setArr[$keys[$k]])) {
                         $v = $this->setArr[$keys[$k]][$j];
                         $this->queryString .= "'" . Constants::$mysqli->escape_string($v) . "'";
                     } else {
                         $v = $this->setArr[$keys[$k]];
                         $this->queryString .= "'" . Constants::$mysqli->escape_string($v) . "'";
                     }
                 }
             }
             //-------------------------------------------------
             //if ($i == sizeof($this->setArr)-1) {
             //$this->queryString = substr($this->queryString, 0, -1);
             $this->queryString .= ")";
             //}
             //-------------------------------------------------
             if ($j < $high - 1) {
                 $this->queryString .= ",";
             }
         }
     }
     //----------------------------------------------------------
     if (!is_null($this->onDuplicate)) {
         $this->queryString .= " ON DUPLICATE KEY UPDATE ";
         $this->queryString = MySQL::condition($this->tableID, $this->onDuplicate, NULL, $this->queryString);
     }
     //----------------------------------------------------------
     if (!$this->returnQuery) {
         $chk = $this->getResult();
         $insert_id = $chk['insert_id'];
//.........这里部分代码省略.........
开发者ID:awwthentic1234,项目名称:hey,代码行数:101,代码来源:InsertINTO.php

示例5: getPlayerEmails

 public function getPlayerEmails($obj)
 {
     $queryString .= "SELECT accounts.email FROM accounts";
     $queryString = MySQL::condition($queryString, array("id" => array("obj" => $obj, "prop" => "id")), "where", $tableID);
     $chk = Result::go($queryString);
     return $chk;
 }
开发者ID:awwthentic1234,项目名称:hey,代码行数:7,代码来源:Pmbl.php

示例6: _getVideos

 private function _getVideos($filters = NULL, $returnQuery = false)
 {
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $resultObj = array_merge(array("chkForQuery" => true, 'returnQuery' => $returnQuery), $this->resultObj);
     $chk = array("bool" => true, "traceID" => "_getVideos");
     //----------------------------------------------------------
     $queryString = $this->getVideo(NULL, true);
     //----------------------------------------------------------
     $queryString = MySQL::condition("videos", $filters, "and", $queryString);
     $queryString .= " ORDER BY videos.id DESC";
     //----------------------------------------------------------
     if ($returnQuery) {
         return $queryString;
     }
     //----------------------------------------------------------
     $chk = Result::go($queryString, $resultObj);
     //----------------------------------------------------------
     $chk['result'] = $this->encodeResult($chk['result']);
     //----------------------------------------------------------
     return $chk;
 }
开发者ID:awwthentic1234,项目名称:hey,代码行数:23,代码来源:VideoOrganizer.php


注:本文中的MySQL::condition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。