本文整理汇总了PHP中MySql类的典型用法代码示例。如果您正苦于以下问题:PHP MySql类的具体用法?PHP MySql怎么用?PHP MySql使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MySql类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: create
public function create($objArr)
{
$cols = [];
$vals = [];
foreach ($objArr as $col => $val) {
$cols[] = $col;
if (is_string($val)) {
$vals[] = "'" . $val . "'";
} else {
$vals[] = $val;
}
}
$cols = implode(',', $cols);
$vals = implode(',', $vals);
if (!MySql::run("INSERT INTO {$this->table} ({$cols}) VALUES ({$vals})")) {
return MySql::getError();
}
return false;
}
开发者ID:Git-Host,项目名称:WebGame,代码行数:19,代码来源:Model.php
示例16: login
/**
* @param $login string
* @param $password string
*/
public static function login($login, $password)
{
if (MySQL::isUser($login, $password)) {
echo "Login is successful";
$table = "users";
$user = MySql::resultArray($login, $password, $table);
$user = $user[0];
$_SESSION['login'] = $login;
$_SESSION['password'] = $password;
$_SESSION['pin'] = $user[3];
$_SESSION['isLoggedIn'] = true;
} else {
echo "Invalid username or password";
$_SESSION['userId'] = "";
$_SESSION['userLogin'] = "";
$_SESSION['isLoggedIn'] = false;
$_SESSION['apiKey'] = "";
}
}
开发者ID:Vovaks,项目名称:coin,代码行数:23,代码来源:Session.php
示例17: get_jsonconfig
function get_jsonconfig($config_name, $file)
{
$table = str_replace('site', '', $file);
$file = CACHE_PATH . "config/{$file}" . CACHE_EXT;
$data = Cache::BEGIN_CACHE($file);
if (!$data) {
$arr = MySql::dbselect('config_name,config_content', "{$table}", "config_name != ''");
for ($i = 0; $i < count($arr); $i++) {
$_config_name = $arr[$i][0];
$_config_content = $arr[$i][1];
$data[$_config_name] = $_config_content;
}
$data = json_encode($data);
Cache::END_CACHE($data, $file);
}
$html = json_decode($data);
$rs = $html->{$config_name};
return $rs;
}
开发者ID:jassonlazo,项目名称:GamersInvasion-Peliculas,代码行数:19,代码来源:functions.php
示例18: AddLog
public static function AddLog($type, $text)
{
if (!IS_LOGIN) {
$arr = 'user';
} else {
if ($_SESSION["RK_Support"]) {
$arr = 'err';
} else {
$userid = $_SESSION["RK_Userid"];
$type = intval($type);
$content = RemoveHack($text);
$user = MySql::dbselect("username", "user", "id = '{$userid}'");
$username = $user[0][0];
if ($type == '1') {
$type = 'Báo lỗi phim';
} else {
if ($type == '2') {
$type = 'Báo lỗi video';
} else {
if ($type == '3') {
$type = 'Báo lỗi hệ thống';
} else {
if ($type == '4') {
$type = 'Yêu cầu chức năng';
} else {
if ($type == '5') {
$type = 'Lỗi Khác';
}
}
}
}
}
$title = $type . " | Gửi từ {$username}";
MySql::dbinsert("log", "title,content", "'{$title}','{$content}'");
$_SESSION["RK_Support"] = 1;
$arr = 'done';
}
}
return $arr;
}
开发者ID:jassonlazo,项目名称:GamersInvasion-Peliculas,代码行数:40,代码来源:support_model.php
示例19: getBlog
/**
* 获取文章信息
*
* @return array
*/
function getBlog($sortid = null)
{
$DB = MySql::getInstance();
$sorts = Cache::getInstance()->readCache('sort');
if (isset($sorts[$sortid])) {
$sort = $sorts[$sortid];
if ($sort['pid'] != 0 || empty($sort['children'])) {
$subsql = "and sortid={$sortid}";
} else {
$sortids = array_merge(array($sortid), $sort['children']);
$subsql = "and sortid in (" . implode(',', $sortids) . ")";
}
} else {
$subsql = $sortid ? "and sortid={$sortid}" : '';
}
$sql = "SELECT * FROM " . DB_PREFIX . "blog WHERE hide='n' and type='blog' {$subsql} ORDER BY date DESC limit 0," . Option::get('rss_output_num');
$result = $DB->query($sql);
$blog = array();
while ($re = $DB->fetch_array($result)) {
$re['id'] = $re['gid'];
$re['title'] = htmlspecialchars($re['title']);
$re['date'] = $re['date'];
$re['content'] = $re['content'];
if (!empty($re['password'])) {
$re['content'] = '<p>[该文章已设置加密]</p>';
} elseif (Option::get('rss_output_fulltext') == 'n') {
if (!empty($re['excerpt'])) {
$re['content'] = $re['excerpt'];
} else {
$re['content'] = extractHtmlData($re['content'], 330);
}
$re['content'] .= ' <a href="' . Url::log($re['id']) . '">阅读全文>></a>';
}
$blog[] = $re;
}
return $blog;
}
开发者ID:szshenjian,项目名称:JIEWU,代码行数:42,代码来源:rss.php
示例20: exportSMS
public function exportSMS()
{
require_once dirname(__FILE__) . "/mysql.php";
$pDB = new MySql();
header("Content-Disposition: attachment; filename=\"smsys_" . date("Y-m-d_His") . ".xml");
header("Content-Type: application/force-download");
echo "<?xml version='1.0' encoding='UTF-8'?>\n<channel>\n\t<title>Export :: SMSYS</title>\n\t<pubDate>" . date("D, j M Y G:i:s T") . "</pubDate>\n";
echo "\t<inbox>\n";
$pDB->Query("SELECT * FROM sms_inbox ORDER BY `Date` DESC");
while ($arSMS = $pDB->FetchAssoc()) {
echo "\t\t<item>\n\t\t\t<datetime>" . date("Y-m-d H:i:s", strtotime($arSMS['Date'])) . "</datetime>\n\t\t\t<number>" . $arSMS['Sender'] . "</number>\n\t\t\t<content>" . $arSMS['Content'] . "</content>\n\t\t</item>\n";
}
echo "\t</inbox>\n";
echo "\t<outbox>\n";
$pDB->Query("SELECT * FROM sms_outbox ORDER BY `Date` DESC");
while ($arSMS = $pDB->FetchAssoc()) {
echo "\t\t<item>\n\t\t\t<datetime>" . date("Y-m-d H:i:s", strtotime($arSMS['Date'])) . "</datetime>\n\t\t\t<number>" . $arSMS['Recipient'] . "</number>\n\t\t\t<content>" . $arSMS['Content'] . "</content>\n\t\t</item>\n";
}
echo "\t</outbox>\n";
echo "</channel>";
$pDB->Log("Export inbox SMSs");
}
开发者ID:skonstantinov89,项目名称:SMSYS,代码行数:22,代码来源:sms.php
注:本文中的MySql类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论