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


PHP MySql類代碼示例

本文整理匯總了PHP中MySql的典型用法代碼示例。如果您正苦於以下問題:PHP MySql類的具體用法?PHP MySql怎麽用?PHP MySql使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: Atualizar

 private function Atualizar(Cliente $cliete)
 {
     $conexao = new MySql();
     $objCliente = new Cliente();
     //Seleciona endereço na base
     $sql = "set @nome='{$cliete->getNome};    \r\n                       set @cpf='{$cliete->getCpf}';\r\n                       set @data_nascimento='{$cliete->getDataNasc}()';\r\n                       set @telefone='{$cliete->getTelefone}()';\r\n                       set @celular='{$cliete->getCelular}()';\r\n                       set @email='{$cliete->getEmail}()';\r\n                       set @cep='{$cliete->getCep}()';\r\n                       set @endereco='{$cliete->getEndereco}()'; \r\n                       set @numero='{$cliete->getNumero}()';\r\n                       set @complemento='{$cliete->getComplemento}()';\r\n                       set @bairro='{$cliete->getBairro}()';\r\n                       set @cidade='{$cliete->getCidade}()';\r\n                       set @uf='{$uf->getUf}()';\r\n                       call USP_MANTER_CLIENTES(@nome,@cpf,@data_nasc,\r\n                       @telefone,@celular,@email,@cep,@endereco,@numero,\r\n                       @complemento,@bairro,@cidade,@uf,NULL,NULL,0);";
     $retorno = $conexao->execSP($sql);
 }
開發者ID:kevinMoreira,項目名稱:Lab,代碼行數:8,代碼來源:dCliente.php

示例2: exportContacts

 public function exportContacts()
 {
     require_once dirname(__FILE__) . "/mysql.php";
     $pDB = new MySql();
     $pDB->Query("SELECT `phonebook`.`Name`, `phonebook`.`Phone` FROM `phonebook` ORDER BY `phonebook`.`Name` ASC");
     header("Content-Disposition: attachment; filename=\"smsys_" . date("Y-m-d_His") . ".vcf");
     header("Content-Type: application/force-download");
     while ($arContact = $pDB->FetchAssoc()) {
         echo "BEGIN:VCARD\nVERSION:2.1\nN:;" . $arContact['Name'] . ";;;\nFN:" . $arContact['Name'] . "\nTEL;CELL;PREF:" . $arContact['Phone'] . "\nEND:VCARD\n";
     }
     $pDB->Log("Export contacts list");
 }
開發者ID:skonstantinov89,項目名稱:SMSYS,代碼行數:12,代碼來源:contacts.php

示例3: getIns

 /**
  * 供外界獲取實例
  * @return MySql
  */
 public static function getIns()
 {
     if (self::$ins == false) {
         self::$ins = new self();
     }
     return self::$ins;
 }
開發者ID:KevinZY,項目名稱:mall,代碼行數:11,代碼來源:MySql.class.php

示例4: getInstance

 /**
  * 靜態方法,返回數據庫連接實例
  */
 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new MySql();
     }
     return self::$instance;
 }
開發者ID:xiaokun123,項目名稱:xiaokun_emlog,代碼行數:10,代碼來源:mysql.php

示例5: Get

 static function Get($key = '')
 {
     if (count(self::$_settings) == 0) {
         self::$_settings = MySql::Instance()->QuickArray("SELECT * FROM settings");
     }
     if (self::$_settings[$key] != null) {
         return self::$_settings[$key];
     }
     return self::$_settings;
 }
開發者ID:samplugins,項目名稱:donation-system,代碼行數:10,代碼來源:settings.php

示例6: updateUnicode

function updateUnicode()
{
    $db = new MySql(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DB);
    $sql = "SELECT\r\n                `id`,\r\n                `character`\r\n            FROM\r\n                `tomoe_character`\r\n            WHERE\r\n                `unicode` = 0\r\n            LIMIT 0,5000;";
    $result = $db->query($sql);
    $num_before = $db->num_rows;
    if ($num_before > 0) {
        $usc_4 = 0;
        foreach ($result as $r) {
            $usc_4 = utf8ToUnicode($r->character);
            $sql = " UPDATE\r\n                tomoe_character\r\n            SET\r\n                unicode = {$usc_4['0']}\r\n        WHERE id = {$r->id};";
            //echo $sql;
            $db->update($sql);
        }
        echo "請刷新頁麵。" . time();
    } else {
        echo "Unicode字段更新完畢";
    }
}
開發者ID:tianxang,項目名稱:php-handwriting,代碼行數:19,代碼來源:import.php

示例7: networkCoins

 /** Get Api Key
  * @param $login string
  * @param $password string
  * @param $coin string
  * @return bool|mysqli_result
  */
 public static function networkCoins($login, $password, $coin)
 {
     $link = MySql::connect();
     $resultArray = null;
     mysqli_query($link, "SET character_set_results = 'utf8'");
     $query = sprintf("SELECT coins.%s as apikey FROM coins,users WHERE users.Email='%s' AND users.Password='%s'", mysqli_real_escape_string($link, trim($coin)), mysqli_real_escape_string($link, trim($login)), mysqli_real_escape_string($link, trim($password)));
     $result = mysqli_query($link, $query);
     $row = mysqli_fetch_array($result);
     $result = $row['apikey'];
     return $result;
 }
開發者ID:Vovaks,項目名稱:coin,代碼行數:17,代碼來源:MySql.php

示例8: getInstance

 public static function getInstance()
 {
     switch (Option::DEFAULT_MYSQLCONN) {
         case 'mysqli':
             return MySqlii::getInstance();
             break;
         case 'mysql':
         default:
             return MySql::getInstance();
             break;
     }
 }
開發者ID:LockGit,項目名稱:emlog,代碼行數:12,代碼來源:database.php

示例9: getDbInstance

 /**
  * 獲取Db實例
  * @param null
  */
 public function getDbInstance()
 {
     if (!is_null($this->_db)) {
         return $this->_db;
     }
     if (class_exists('mysqli')) {
         $this->_db = MySqlii::getInstance();
     } else {
         $this->_db = MySql::getInstance();
     }
     return $this->_db;
 }
開發者ID:jjonline,項目名稱:juser,代碼行數:16,代碼來源:juser_functions.php

示例10: getInstance

 public static function getInstance()
 {
     if (class_exists('mysqli', FALSE)) {
         return MySqlii::getInstance();
     } else {
         if (class_exists('mysql', FALSE)) {
             return MySql::getInstance();
         } else {
             emMsg('服務器空間PHP不支持MySql數據庫');
         }
     }
 }
開發者ID:flyysr,項目名稱:emlog,代碼行數:12,代碼來源:database.php

示例11: asc_time_limit

function asc_time_limit($ip, $time_limit)
{
    $DB = MySql::getInstance();
    if ($time_limit <= 0) {
        return;
    }
    $time_line = time() - $time_limit;
    $sql = "SELECT ip FROM " . DB_PREFIX . "comment WHERE ip='{$ip}' AND date > {$time_line}";
    $query = $DB->query($sql);
    $num = $DB->num_rows($query);
    if ($num) {
        ascMsg("{$time_limit}秒內隻能發表一次評論,評論發表失敗");
    }
}
開發者ID:LockGit,項目名稱:emlog,代碼行數:14,代碼來源:anti_spam_comment.php

示例12: getValue

 public function getValue()
 {
     require "mysql_util.php";
     if (isset($operandValue)) {
         return $operandValue;
     }
     $mysqli = MySql::getConnection();
     $questionID = trim($operandString, "[]");
     $mysql_value = $mysqli->query("SELECT `Response` FROM Questions WHERE `ID` = '{$questionID}'");
     if (!$mysql_value) {
         throw new Exception("There was a MySQL error: {$mysqli->error}");
         return false;
     }
     $mysql_value = mysqli_fetch_assoc($mysql_value);
     return $mysql_value['Response'];
 }
開發者ID:brianmpollack,項目名稱:PHP-Equation-Evaluator,代碼行數:16,代碼來源:operand.php

示例13: __construct

 public function __construct()
 {
     if (is_null(self::$DbHandler)) {
         if (class_exists('mysqli')) {
             self::$DbHandler = MySqlii::getInstance();
         } else {
             self::$DbHandler = MySql::getInstance();
         }
     }
     $this->tableName = DB_PREFIX . $this->tableName;
     $this->fields = $this->getDbFields();
     foreach ($this->fields as $key => $value) {
         $this->SQLfields .= $this->parseKey($value) . ',';
     }
     $this->SQLfields = rtrim($this->SQLfields, ',');
     #查詢的全字段預處理
 }
開發者ID:jjonline,項目名稱:juser,代碼行數:17,代碼來源:juser_model.php

示例14: getSmallImg

function getSmallImg($gid)
{
    $db = MySql::getInstance();
    $sql = "SELECT excerpt FROM " . DB_PREFIX . "blog WHERE checked='y' and password='' and gid=" . $gid;
    $query = $db->query($sql);
    while ($row = $db->fetch_array($query)) {
        preg_match_all("/<img([^>]+)src=\"([^>\"]+)\"?([^>]*)>/i", $row['excerpt'], $matches);
        //從摘要找縮略圖
        if ($matches[2][1]) {
            //$imgsrc=$matches[2][1]?$matches[2][1]:$matches[2][0];
            $imgsrc = $matches[2][1];
        } else {
            $imgsrc = TEMPLATE_URL . "img/bgtest.png";
        }
    }
    return $imgsrc;
}
開發者ID:Bigstars,項目名稱:Wangjx.org,代碼行數:17,代碼來源:module.php

示例15: canRemoveEntity

 /**
  * @test
  */
 public function canRemoveEntity()
 {
     $expectedConditions = array('id' => 1);
     $this->storage->expects($this->once())->method('deleteWhere')->with($expectedConditions)->will($this->returnValue(1));
     $entity = $this->createEntity();
     $entity->setId(1);
     $this->repository->remove($entity);
     $this->assertEquals(null, $entity->getId());
 }
開發者ID:koinephp,項目名稱:repository,代碼行數:12,代碼來源:IdAwareRepositoryTest.php


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