当前位置: 首页>>代码示例>>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;未经允许,请勿转载。