本文整理汇总了PHP中MysqliDb类的典型用法代码示例。如果您正苦于以下问题:PHP MysqliDb类的具体用法?PHP MysqliDb怎么用?PHP MysqliDb使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MysqliDb类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getListComposersDb
function getListComposersDb()
{
$db = new MysqliDb(HOST, USER, PASSWORD, DBNAME);
$query = "SELECT * FROM composers";
$composers = $db->rawQuery($query);
return $composers;
}
示例2: GET
function GET()
{
$db = new MysqliDb($this->config["host"], $this->config["user"], $this->config["pass"], $this->config["base"]);
$results = $db->get('VIP');
if (!empty($results) && count($results) > 0) {
SimplestView::render('index', array("results" => $results));
}
}
示例3: json_encode
echo json_encode(true);
} else {
echo json_encode(false);
}
}
function update($item)
{
$db = new MysqliDb();
$decoded = json_decode($item);
$db->where('revista_id', $decoded->revista_id);
$data = array('nombre' => $decoded->nombre, 'link' => $decoded->link);
if ($db->update('revistas', $data)) {
示例4: GET
function GET($matches)
{
if ($matches[1]) {
$db = new MysqliDb($this->config["host"], $this->config["user"], $this->config["pass"], $this->config["base"]);
$results = $db->where('idphoto', $matches[1])->get('photo', 1);
if (!empty($results) && count($results) > 0) {
header("Content-Type: image/jpg");
header("Content-Length: " . strlen($results[0]["contenu"]));
echo $results[0]["contenu"];
}
}
}
示例5: json_encode
echo json_encode(true);
} else {
echo json_encode(false);
}
}
/**
* esta funcion me retorna un cliente filtrando x email
* @param $email
*/
function update($item)
{
$db = new MysqliDb();
$decoded = json_decode($item);
示例6: insertCompositionsOnDB
function insertCompositionsOnDB()
{
$composers = getListComposers();
foreach ($composers as $index => $composer) {
$slug = getSlugComposer($composer);
$relevance = $index + 1;
$db = new MysqliDb(HOST, USER, PASSWORD, DBNAME);
$query = "INSERT INTO `composers`(`slug`,`name`,`relevance`)";
$query .= " VALUES ('" . $slug . "','" . $composer . "','" . $relevance . "');";
echo $query . PHP_EOL;
$db->rawQuery($query);
}
}
示例7: order_paid
function order_paid()
{
require_once './submodules/php-mysqli-database-class/MysqliDb.php';
require './includes/config.php';
$db = new MysqliDb($db_host, $db_user, $db_pass, $db_name);
$payid = $_GET['out_trade_no'];
$aPayId = explode('_', $payid);
$mtrid = $aPayId[1];
$params = json_encode($_GET);
//验证是否已经支付过
$db->where("mtr_id = '{$mtrid}'")->get('mark_trafficpolice_reward');
if ($db->count == 0) {
$aNew = array('mtr_id' => $mtrid, 'pay_id' => $payid, 'pay_success' => 1, 'pay_money' => $_GET['total_fee'], 'pay_date' => $_GET['gmt_payment'], 'pay_params' => $params, 'created_date' => $db->now());
$id = $db->insert('mark_trafficpolice_reward', $aNew);
//给用户增加余额
$sql = "SELECT mt.user_id,u.user_money FROM `mark_trafficpolice` mt\n LEFT JOIN mark_trafficpolice_received mtr ON mt.id=mtr.mt_id\n LEFT JOIN users u ON u.user_id=mt.user_id\n WHERE mtr.id= '{$mtrid}'";
$aUser = $db->rawQuery($sql);
if ($db->count) {
$aUpdate = array('user_money' => $aUser[0]['user_money'] + $_GET['total_fee'], 'updated_date' => $db->now());
$db->where('user_id', $aUser[0]['user_id']);
$db->update('users', $aUpdate);
}
} else {
echo "already rewarded";
}
}
示例8: getInstance
public static function getInstance($dbKey = 'DB')
{
if (array_key_exists($dbKey, self::$db)) {
return self::$db[$dbKey];
} else {
$newdb = new MysqliDb($dbKey);
if ($newdb->connect()) {
self::$db[$dbKey] = $newdb;
return $newdb;
} else {
return false;
}
}
}
示例9: insertComposersOnDB
function insertComposersOnDB()
{
$db = new MysqliDb(HOST, USER, PASSWORD, DBNAME);
$composers = getListComposersDb();
foreach ($composers as $index => $composer) {
$compositions = extractCompositionsFromSearchHtmls($composer['name']);
foreach ($compositions as $composition) {
echo "Inserting " . $composition . "..." . PHP_EOL;
$relevance = $index + 1;
$query = "INSERT INTO `compositions`(`composer_id`,`name`,`relevance`)";
$query .= " VALUES ('" . $composer['id'] . "','" . escapeSingleQuote($composition) . "','" . $relevance . "');";
$db->rawQuery($query);
}
}
}
示例10: showzx
function showzx()
{
$zid = req('zid');
$start = req('start', 0);
$perpage = req('perpage', 0);
if ($start < 0) {
$start = 0;
}
if (empty($perpage)) {
$perpage = 30;
}
if (empty($zid)) {
showjson('zid_not_exist');
}
$db = MysqliDb::getInstance();
$data = $db->rawQueryOne("SELECT z.*, u.username FROM zixun z LEFT JOIN users u ON z.uid=u.uid WHERE z.zid='{$zid}'");
if ($db->count > 0) {
$db->where("zid", $zid);
$stats = $db->getOne("comment", "count(*) as cnt");
$data['total'] = $stats['cnt'];
//if($start>=$data['total']) $start=0;
$comment = $db->rawQuery("SELECT c.*,s.username FROM comment c LEFT JOIN users s ON c.uid=s.uid WHERE c.zid='{$zid}' ORDER BY c.cid LIMIT {$start},{$perpage}");
$data['count'] = $db->count;
$data['comment'] = $comment;
showjson('do_success', 0, array("zixun" => $data));
}
showjson('show_error');
}
示例11: saveSlider
function saveSlider($slider)
{
$db = new MysqliDb();
$item_decoded = $slider;
// $fotos_decoded = json_decode($producto->fotos);
$db->where('oferta_id', $item_decoded->slider_id);
$data = array('producto_id' => $item_decoded->producto_id, 'precio' => $item_decoded->precio, 'descripcion' => $item_decoded->descripcion, 'imagen' => $item_decoded->imagen, 'titulo' => $item_decoded->titulo);
$results = $db->update('ofertas', $data);
$res = ['status' => 1, 'results' => 0];
echo json_encode($results);
if ($results) {
$res["results"] = $results;
echo json_encode($res);
} else {
$res->status = 0;
echo $res;
}
}
示例12: __construct
public function __construct()
{
/** @var array $db */
include_once 'config.php';
require_once 'PHP-MySQLi-Database-Class-master/MysqliDb.php';
new MysqliDb($db);
$this->db_instance = MysqliDb::getInstance();
$this->db_config = $db;
}
示例13: __construct
/**
* constructor
*
* @param string $type tipo de datamanager a ser incializado
*
* inicializa o objeto de log e de bd
* inicializa o vetor de dados nulo de acordo com o tipo
*/
function __construct($type)
{
$this->db = MysqliDb::getInstance();
$this->log = Log::getInstance();
//tipo de dado valido pra iniciar
if (array_key_exists($type, $this->_validFields)) {
$this->type = $type;
foreach ($this->_validFields[$this->type] as $key => $value) {
$this->setField($key, null);
}
}
}
示例14: routeToCrm
public function routeToCrm($host, $username, $password, $databaseName)
{
if (isset($_COOKIE['username'])) {
$user = $_COOKIE['username'];
}
if (isset($_COOKIE['mdp'])) {
//Récupération du mot de passe stocké
$db = new MysqliDb($host, $username, $password, $databaseName);
$db->where("user_name", $user);
$users = $db->getOne("users");
$pwd = $users['user_hash'];
// Création du mot de passe hashé
// $mdp = crypt(strtolower($_COOKIE['mdp']),$pwd);
$mdp = $_COOKIE['mdp'];
}
// Login au CRM
$url = "http://localhost/mysite/crm74/service/v4_1/soap.php?wsdl";
require_once "../crm74/include/nusoap/lib/nusoap.php";
//retrieve WSDL
$client = new nusoap_client($url, 'wsdl');
$proxy = $client->getProxy();
//Affichage des erreurs
$err = $client->getError();
if ($err) {
echo '<h2>Erreur du constructeur</h2><pre>' . $err . '</pre>';
echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>';
exit;
}
// login ----------------------------------------------------
$login_parameters = array('user_auth' => array('user_name' => $user, 'password' => $mdp, 'version' => '1'), 'application_name' => 'SugarTest');
$login_result = $client->call('login', $login_parameters);
echo '<pre>';
//get session id
$session_id = $login_result['id'];
$result = $proxy->seamless_login($session_id);
// Ouverture de la session SuiteCRM
header("Location: http://localhost/mysite/crm74/index.php?module=Administration&action=index&MSID={$session_id}");
}
示例15: buildOutput
/**
* Created by PhpStorm.
* User: André
* Date: 01/04/2015
* Time: 13:57
*/
function buildOutput($data, $debug = false)
{
$log = Log::getInstance();
$db = MysqliDb::getInstance();
$output = array();
if ($log->countErrors() > 0) {
$errors = $log->getErrors();
}
$output = $data;
if (isset($errors) && sizeof($errors) > 0) {
$output['_ERROR_'] = $errors;
}
if ($debug == 'true') {
$output['_DEBUG_'] = $log->getLogs();
}
echo json_encode($output, JSON_PRETTY_PRINT);
}