本文整理汇总了PHP中MysqliDb::where方法的典型用法代码示例。如果您正苦于以下问题:PHP MysqliDb::where方法的具体用法?PHP MysqliDb::where怎么用?PHP MysqliDb::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MysqliDb
的用法示例。
在下文中一共展示了MysqliDb::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: removeComentario
/**
* @description Elimina una comentario
* @param $comentario_id
*/
function removeComentario($comentario_id)
{
validateRol(0);
$db = new MysqliDb();
$db->where("comentario_id", $comentario_id);
$results = $db->delete('posts_comentarios');
if ($results) {
echo json_encode(1);
} else {
echo json_encode(-1);
}
}
示例2: 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";
}
}
示例3: update
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: 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;
}
}
示例6: 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}");
}
示例7: MysqliDb
<?php
//Authentication script
require_once 'MysqliDb.php';
$email_id = "rolet.fernandes@gmail.com";
//$POST_['email_id'];
$password = "oliver";
//$POST_['password'];
$db = new MysqliDb('localhost', 'root', 'hack123', 'colgpolls');
$db->where("email_id", $email_id);
$user = $db->getOne("users");
if ($user['password'] == $password) {
echo "authenticated";
} else {
echo "wrong username or password";
}
示例8: header
if ($password1 != $password2) {
header("Location: " . $baseurl . "user/new/provider/?status=error&code=password&" . $querystring);
exit;
}
$secret = "6LfdFBUTAAAAAF40Be_HnpwT_Oj6CyDAsgtLohW_";
$recaptcha = new \ReCaptcha\ReCaptcha($secret);
$resp = $recaptcha->verify($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']);
if ($resp->isSuccess()) {
// verified!
} else {
$errors = $resp->getErrorCodes();
header("Location: " . $baseurl . "user/new/provider/?status=error&code=captcha&" . $querystring . "&respcode=" . http_build_query($errors));
exit;
}
$db = new MysqliDb(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
$db->where("email", $email);
if ($db->has("users")) {
header("Location: " . $baseurl . "user/new/provider/?status=error&code=exists&" . $querystring);
exit;
}
$Auth = new Auth();
// $result = $Auth->createUser($email, $password, $fname, $lname, $is_active = 1, $is_admin = 0, $is_provider = 0, $is_super = 0, $is_verified = 0);
$result = $Auth->createUser($email, $password1, $fn, $ln, 1, 0, 1, 0, 0);
if ($result['status']) {
$attribute = array('pn' => $pn, 'ph' => $ph, 'title' => $prof, 'zip' => $zip);
if ($Auth->setAttr($result['id'], $attribute)) {
header("Location: " . $baseurl . "user/new/provider/done.php?e=" . $email);
} else {
die("auth error");
}
} else {
示例9: trasladar
/**
* @description Mueve una determinada cantidad de un producto a otra sucursal
* @param $origen_id
* @param $destino_id
* @param $producto_id
* @param $cantidad
*/
function trasladar($origen_id, $destino_id, $producto_id, $cantidad)
{
$db = new MysqliDb();
$cant_a_mover = $cantidad;
$stock_origen = $db->rawQuery('select stock_id, cant_actual, costo_uni, proveedor_id from stock where sucursal_id = ' . $origen_id . '
and producto_id = ' . $producto_id . ' order by stock_id asc');
foreach ($stock_origen as $row) {
if ($cant_a_mover > 0 && $row["cant_actual"] > 0) {
if ($row["cant_actual"] < $cant_a_mover) {
$db->where('stock_id', $row['stock_id']);
$data = array('cant_actual' => 0);
$db->update('stock', $data);
$insertar = array('producto_id' => $producto_id, 'proveedor_id' => $row['proveedor_id'], 'sucursal_id' => $destino_id, 'cant_actual' => $cant_a_mover - $row["cant_actual"], 'cant_inicial' => $cant_a_mover - $row["cant_inicial"], 'costo_uni' => $row['costo_uni']);
$db->insert('stock', $insertar);
$cant_a_mover = $cant_a_mover - $row["cant_actual"];
}
if ($row["cant_actual"] > $cant_a_mover) {
$db->where('stock_id', $row['stock_id']);
$data = array('cant_actual' => $row["cant_actual"] - $cant_a_mover);
$db->update('stock', $data);
$insertar = array('producto_id' => $producto_id, 'proveedor_id' => $row['proveedor_id'], 'sucursal_id' => $destino_id, 'cant_actual' => $cant_a_mover, 'cant_inicial' => $cant_a_mover, 'costo_uni' => $row['costo_uni']);
$db->insert('stock', $insertar);
$cant_a_mover = 0;
}
if ($row["cant_actual"] == $cant_a_mover) {
$db->where('stock_id', $row['stock_id']);
$data = array('cant_actual' => 0);
$db->update('stock', $data);
$insertar = array('producto_id' => $producto_id, 'proveedor_id' => $row['proveedor_id'], 'sucursal_id' => $destino_id, 'cant_actual' => $cant_a_mover, 'cant_inicial' => $cant_a_mover, 'costo_uni' => $row['costo_uni']);
$db->insert('stock', $insertar);
$cant_a_mover = 0;
}
}
}
echo json_encode($db->getLastError());
}
示例10: getCarritos
/**
* @descr Obtiene los productos. En caso de enviar un usuario_id != -1, se traerán todos los carritos. Solo usar esta opción cuando se aplica en la parte de administración
*/
function getCarritos($usuario_id)
{
$db = new MysqliDb();
if ($usuario_id != -1) {
$db->where('c.usuario_id', $usuario_id);
}
$db->join("usuarios u", "u.usuario_id=c.usuario_id", "LEFT");
$results = $db->get('carritos c', null, 'c.carrito_id, c.status, c.total, c.fecha, c.usuario_id, u.nombre, u.apellido');
foreach ($results as $key => $row) {
$db = new MysqliDb();
$db->where('carrito_id', $row['carrito_id']);
$db->join("productos p", "p.producto_id=c.producto_id", "LEFT");
$productos = $db->get('carrito_detalles c', null, 'c.carrito_detalle_id, c.carrito_id, c.producto_id, p.nombre, c.cantidad, c.en_oferta, c.precio_unitario');
$results[$key]['productos'] = $productos;
}
echo json_encode($results);
}
示例11: explode
echo '<html lang="en">' . "\n";
echo ' <head>' . "\n";
echo ' <meta charset="utf-8">' . "\n";
echo ' <title>Log In</title>' . "\n";
echo ' <link rel="stylesheet" type="text/css" href="css/login_form.css">' . "\n";
echo ' </head>' . "\n";
echo ' <body>' . "\n";
if (isset($_POST['submitted'])) {
$submited = $_POST['submitted'];
$name = explode(" ", $_POST['name']);
$pass = $_POST['pass'];
if (isset($pass) && !empty($pass)) {
if (isset($name) && !empty($name[0])) {
if (count($name) >= 1 && count($name) <= 2) {
if (count($name) > 1) {
$db->where('fName', $name[0]);
$db->where('lName', $name[1]);
} else {
$db->where('fName', $name);
$db->orWhere('lName', $name);
}
$user = $db->getOne("Users");
$hash = $user['password'];
if (password_verify($pass, $hash)) {
echo 'Password is valid!';
$_SESSION['user'] = new User($user['id'], $user['fName'], $user['lName'], $user['admin']);
} else {
echo 'Invalid password.';
}
} else {
echo "invalid Name given";
示例12: getDonaciones
/**
* @description Retorna las donaciones, en caso de ser la consulta de un usuario, solo trae las del usuario
* @param $usuario_id
*/
function getDonaciones($usuario_id)
{
$db = new MysqliDb();
$where = '';
if ($usuario_id != -1) {
$where = 'c.donador_id in (select usuario_id from proyectos p1 where p1.proyecto_id = p.proyecto_id)';
}
$results = $db->rawQuery('donaciones c', null, 'c.donacion_id, c.status, c.total, c.fecha, c.usuario_id, u.nombre, u.apellido');
foreach ($results as $key => $row) {
$db = new MysqliDb();
$db->where('donacion_id', $row['donacion_id']);
$db->join("proyectos p", "p.proyecto_id=c.proyecto_id", "LEFT");
$proyectos = $db->get('donacion_detalles c', null, 'c.donacion_detalle_id, c.donacion_id, c.proyecto_id, p.nombre, c.cantidad, c.en_oferta, c.precio_unitario');
$results[$key]['proyectos'] = $proyectos;
}
echo json_encode($results);
}
示例13: Form
$form = new Form();
$log = new LogActivity();
$db2 = new MysqliDb(DBHOST, DBUSER, DBPASS, DBNAME);
isset($_POST['page']) ? $currentPage = $_POST['page'] : ($currentPage = 0);
$pageLimit = 50;
if ($currentPage == 0) {
$currentPage = 1;
}
$limitFrom = $pageLimit * $currentPage - $pageLimit;
switch ($_POST['f']) {
//search by region
case 'fetch_logs':
//db2 is for getting total number of rows
if (isset($_POST['search_term']) && $_POST['search_term'] != null) {
$db->where('action LIKE "%' . $_POST['search_term'] . '%"');
$db2->where('action LIKE "%' . $_POST['search_term'] . '%"');
} else {
$db->where('action LIKE "%%"');
$db2->where('action LIKE "%%"');
}
if (isset($_POST['user']) && $_POST['user'] != null) {
$db->where('user_id="' . $_POST['user'] . '"');
$db2->where('user_id="' . $_POST['user'] . '"');
} else {
$db->where('user_id LIKE "%%"');
$db2->where('user_id LIKE "%%"');
}
$db->orderBy("date_time", "DESC");
$results = $db->get("log_activity", array($limitFrom, $pageLimit));
//$db->echoQuery();
$db2->withTotalCount()->get("log_activity");
示例14: MysqliDb
<?php
require_once 'MysqliDb.php';
require_once 'constantes.php';
$bd = new MysqliDb(SERVER_DB_URL, SERVER_DB_USUARIO, SERVER_DB_PASS, SERVER_DB_NOMBRE);
if (!$bd->ping()) {
$bd->connect();
}
if ($_SERVER["REQUEST_METHOD"] == REQUEST_METODO_POST) {
$postdata = json_decode(file_get_contents('php://input'));
$usuario_form = $postdata->usuario;
$pass_form = md5($postdata->pass);
$bd->where(COLUMNA_EMAIL, $usuario_form);
$bd->where(COLUMNA_PASS, $pass_form);
if ($bd->has(TABLA_USUARIO)) {
$arr = array(RESPUESTA_MENSAJE => MENSAJE_OK, RESPUESTA_ERROR => ERROR_NINGUNO);
} else {
$arr = array(RESPUESTA_ERROR => ERROR_PHP_POST);
}
$jsn = json_encode($arr);
print_r($jsn);
}
示例15: getCupones
function getCupones($cliente_id, $numero)
{
$db = new MysqliDb();
$db->join("clientes c", "c.cliente_id=u.cliente_id", "LEFT");
if ($cliente_id != -1) {
$db->where('u.cliente_id', $cliente_id);
}
if ($numero != -1) {
$db->where('c.numero', $numero);
}
$result = $db->get('cupones u', null, 'u.numero, u.fecha, c.mail');
echo json_encode($result);
}