当前位置: 首页>>代码示例>>PHP>>正文


PHP MysqliDb::insert方法代码示例

本文整理汇总了PHP中MysqliDb::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP MysqliDb::insert方法的具体用法?PHP MysqliDb::insert怎么用?PHP MysqliDb::insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MysqliDb的用法示例。


在下文中一共展示了MysqliDb::insert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createCupon

function createCupon($cliente_id, $numero)
{
    $db = new MysqliDb();
    $data = array('cliente_id' => $cliente_id, 'numero' => $numero);
    $result = $db->insert('cupones', $data);
    if ($result > -1) {
        echo json_encode(true);
    } else {
        echo json_encode(false);
    }
}
开发者ID:arielcessario,项目名称:hydrox-V2,代码行数:11,代码来源:cliente.php

示例2: time

<?php

session_start();
setcookie('Login_cookie', '', time() - 3600);
session_destroy();
require_once 'classes/class.mysqli.php';
require_once 'includes/required.inc.php';
$db = new MysqliDb(DBHOST, DBUSER, DBPASS, DBNAME);
$insert_log = array('user_id' => $_SESSION['user_id'], 'action' => 'User Logged out!', "date_time" => date("Y-m-d H:i:s"));
$log = $db->insert('log_activity', $insert_log);
echo "<meta http-equiv=\"refresh\" content=\"0;URL=index.php\">";
开发者ID:arshanam,项目名称:pharmacy_app,代码行数:11,代码来源:logout.php

示例3: setNextMessage

/**
 * save next message
 * @param $text
 * @param $chatid
 * @param MysqliDb $db
 * @param TelegramBot\Api\BotApi $bot
 */
function setNextMessage($text, $chatid, $db, $bot)
{
    if ($db->insert('nextMessages', array('text' => $text))) {
        $bot->sendMessage($chatid, 'پیام مورد نظر ثبت شد');
        $db->update('adminOperations', array('next_status' => 0));
    }
}
开发者ID:hoseinBL,项目名称:SoftwareTalks,代码行数:14,代码来源:functions.php

示例4: 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";
    }
}
开发者ID:szgongyi,项目名称:TrafficPolice-Web,代码行数:26,代码来源:alipay.php

示例5: save

    $decoded = json_decode($item);
    $db->where('revista_id', $decoded->revista_id);
    $results = $db->delete('revistas');
    echo json_encode($results);
}
function save($item)
{
    $db = new MysqliDb();
    $decoded = json_decode($item);
    $data = array('nombre' => $decoded->nombre, 'link' => $decoded->link);
    $result = $db->insert('revistas', $data);
    if ($result > -1) {
开发者ID:arielcessario,项目名称:uiglp,代码行数:12,代码来源:revistas.php

示例6: create

    $decoded = json_decode($item);
    $db->where('oferta_laboral_id', $decoded->oferta_laboral_id);
    $results = $db->delete('ofertas_laborales');
    echo json_encode($results);
}
function create($item)
{
    $db = new MysqliDb();
    $decoded = json_decode($item);
    $data = array('titulo' => $decoded->titulo, 'detalle' => $decoded->detalle, 'cliente_id' => $decoded->cliente_id, 'status' => 1);
    $result = $db->insert('ofertas_laborales', $data);
    if ($result > -1) {
开发者ID:arielcessario,项目名称:uiglp,代码行数:12,代码来源:ofertas_laborales.php

示例7: createSucursal

/**
 * @description Crea una sucursal
 * @param $sucursal
 */
function createSucursal($sucursal)
{
    $db = new MysqliDb();
    $db->startTransaction();
    $sucursal_decoded = checkSucursal(json_decode($sucursal));
    $data = array('nombre' => $sucursal_decoded->nombre, 'direccion' => $sucursal_decoded->direccion, 'telefono' => $sucursal_decoded->telefono);
    $result = $db->insert('sucursales', $data);
    if ($result > -1) {
        $db->commit();
        echo json_encode($result);
    } else {
        $db->rollback();
        echo json_encode(-1);
    }
}
开发者ID:arielcessario,项目名称:ac-angular-sucursales,代码行数:19,代码来源:ac-sucursales.php

示例8: insert

 /**
  * @return mixed insert id or false in case of failure
  */
 public function insert()
 {
     if (!empty($this->timestamps) && in_array("createdAt", $this->timestamps)) {
         $this->createdAt = date("Y-m-d H:i:s");
     }
     $sqlData = $this->prepareData();
     if (!$this->validate($sqlData)) {
         return false;
     }
     $id = $this->db->insert($this->dbTable, $sqlData);
     if (!empty($this->primaryKey) && !isset($this->data[$this->primaryKey])) {
         $this->data[$this->primaryKey] = $id;
     }
     $this->isNew = false;
     return $id;
 }
开发者ID:nightstomp,项目名称:PHP-MySQLi-Database-Class,代码行数:19,代码来源:dbObject.php

示例9: date

<?php

require_once 'MysqliDb.php';
//Extracts question from forms and stores into database
$question_username = "oliver";
//$_POST['question_username'];
$question = "college canteen needs to be improved";
//$_POST['question'];
$description = "details";
//$_POST['description'];
$type = "general";
//$_POST['branch'];                //branch or general
$timestamp = date('Y-m-d H:i:s');
$db = new MysqliDb('localhost', 'root', 'hack123', 'colgpolls');
$data = array("question" => $question, "description" => $description, "question_username" => $question_username, "timestamp" => $timestamp);
$id = $db->insert('polls', $data);
$db->where("timestamp", $timestamp);
$user = $db->getOne("polls");
$data = array("pid" => $user['pid']);
/* There are two types of question category : general or branch based
	Store values according catogery in database */
if ($type == 'general') {
    $db->insert('CSE', $data);
    $db->insert('MECH', $data);
    $db->insert('TCE', $data);
    $db->insert('ECE', $data);
} else {
    if ($type == 'CSE') {
        $db->insert('CSE', $data);
    } else {
        if ($type == 'TCE') {
开发者ID:rahulrk95,项目名称:kulizahack,代码行数:31,代码来源:question_post.php

示例10: createCarrito

/**
 * @description Crea un carrito y su detalle
 * @param $carrito
 */
function createCarrito($carrito)
{
    $db = new MysqliDb();
    $db->startTransaction();
    $carrito_decoded = checkCarrito(json_decode($carrito));
    $data = array('status' => $carrito_decoded->status, 'total' => $carrito_decoded->total, 'fecha' => $carrito_decoded->fecha, 'usuario_id' => $carrito_decoded->usuario_id, 'origen' => $carrito_decoded->origen, 'destino' => $carrito_decoded->destino);
    $result = $db->insert('carritos', $data);
    if ($result > -1) {
        //        foreach ($carrito_decoded->detalles as $detalle) {
        //            $data = array(
        //                'carrito_id' => $result,
        //                'producto_id' => $detalle->producto_id,
        //                'cantidad' => $detalle->cantidad,
        //                'en_oferta' => $detalle->en_oferta,
        //                'precio_unitario' => $detalle->precio_unitario
        //            );
        //
        //            $pre = $db->insert('carrito_detalles', $data);
        //            if ($pre > -1) {
        //                $db->rollback();
        //                echo json_encode(-1);
        //                return;
        //            }
        //        }
        $db->commit();
        //echo json_encode($result);
        $data['carrito_id'] = $result;
        echo json_encode($data);
    } else {
        $db->rollback();
        echo json_encode(-1);
    }
}
开发者ID:arielcessario,项目名称:ac-angular-productos,代码行数:37,代码来源:ac-productos.php

示例11: explode

$surface = $_POST['surface'];
$parking = $_POST['parking'];
$facilities = $_POST['facilities'];
$hours = $_POST['hours'];
$loopcount = $_POST['loopcount'];
$satImgURL = $_POST['satImgURL'];
$largeImgURL = $_POST['largeImgURL'];
$thumbURL = $_POST['thumbURL'];
$attrArray = explode(',', $_POST['attrArray']);
$loopcount = $_POST['loopcount'];
$published = $_POST['publish'];
$attractions = array();
foreach ($attrArray as $index => $attractionID) {
    array_push($attractions, rawurlencode($_POST['attraction' . $attractionID]));
}
$loops = array();
$i = 1;
while ($i <= $loopcount) {
    $loops[$i]["name"] = $_POST['loop' . $i . 'name'];
    $loops[$i]["distance"] = $_POST["loop" . $i . "distance"];
    $loops[$i]["steps"] = intval($_POST["loop" . $i . "steps"]);
    $i++;
}
$googlemaps = "https://maps.google.com/maps?q=" . urlencode($address . ", " . $city . ", NM" . $zip) . "&output=embed";
$data = array('name' => $name, 'city' => $city, 'zip' => $zip, 'crossstreets' => $crossstreets, 'address' => $address, 'transit' => $transit, 'lat' => $lat, 'lng' => $lng, 'desc' => $desc, 'lighting' => $lighting, 'difficulty' => $difficulty, 'surface' => $surface, 'parking' => $parking, 'facilities' => $facilities, 'hours' => $hours, 'loopcount' => $loopcount, 'satImgURL' => $satImgURL, 'largeImgURL' => $largeImgURL, 'thumbURL' => $thumbURL, 'attractions' => addslashes(json_encode($attractions)), 'loops' => addslashes(json_encode($loops)), 'published' => $published);
$id = $db->insert('trails', $data);
if ($id) {
    header("Location: " . $baseurl . "admin/new/done.php?id=" . $id);
} else {
    echo 'insert failed: ' . $db->getLastError();
}
开发者ID:jmayfiel,项目名称:prescriptiontrails,代码行数:31,代码来源:post.php

示例12: 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());
}
开发者ID:arielcessario,项目名称:ac-angular-stocks,代码行数:43,代码来源:ac-stocks.php

示例13: explode

echo '		<link rel="stylesheet" type="text/css" href="css/login_form.css">' . "\n";
echo '	</head>' . "\n";
echo '	<body>' . "\n";
if (isset($_POST['submitted']) && $_POST['pass'] === $_POST['repass']) {
    $submited = $_POST['submitted'];
    $name = explode(" ", $_POST['name']);
    $fName = $name[0];
    $lName = $name[1];
    $email = $_POST['email'];
    $phone = $_POST['phone'];
    $intro = $_POST['intro'];
    $pass = $_POST['pass'];
    $options = ['cost' => 17];
    $pass = password_hash($pass, PASSWORD_BCRYPT, $options) . "\n";
    $data = array('password' => $pass, 'active' => true, 'fName' => $fName, 'lName' => $lName, 'email' => $email, 'phone' => $phone, 'intro' => $intro, 'createdAt' => $db->now(), 'expires' => $db->now('+1Y'));
    $id = $db->insert('Users', $data);
    if ($id) {
        echo 'user was created. Id=' . $id;
    } else {
        echo 'insert failed: ' . $db->getLastError();
    }
} else {
    echo '		<form name="signup" action="" method="post" autocomplete="on">' . "\n";
    echo '		<ul>' . "\n";
    echo '			<li>' . "\n";
    echo '				<h2>Contact Us</h2>' . "\n";
    echo '				<span class="required_notification">* Denotes Required Field</span>' . "\n";
    echo '			</li>' . "\n";
    echo '			<li>' . "\n";
    echo '				<label for="name"><font color="black">Name:</font></label>' . "\n";
    echo '				<input id="name" name="name" type="text" autofocus required pattern="[A-Za-z0-9]+\\s[A-Za-z0-9]+" />' . "\n";
开发者ID:AlanBridgeman,项目名称:D-DTabletopWebapp,代码行数:31,代码来源:signup.php

示例14: newLog

 public function newLog($uid, $type, $distance, $steps, $time, $date, $trail_id = null, $trail_name = null)
 {
     $db = new MysqliDb(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
     $data = array("uid" => $uid, "type" => $type, "trail_id" => $trail_id, "distance" => $distance, "steps" => $steps, "time" => $time, "trail_name" => $trail_name, "date" => $date);
     $id = $db->insert('activities', $data);
     if ($id) {
         $return = array("status" => "done", "id" => $id);
     } else {
         $return = array("status" => "error", "message" => "A MySQLi error has occurred.", "tech" => $db->getLastError());
     }
     return $return;
 }
开发者ID:jmayfiel,项目名称:prescriptiontrails,代码行数:12,代码来源:db.php

示例15: Conf

    require 'conf.php';
    require 'sql.php';
    $c = new Conf();
    $o = new MysqliDb($c->host, $c->username, $c->password, $c->db);
    $insArr = array();
    foreach ($_POST as $key => $value) {
        if ($key == "valuation" || $key == "currentfunding") {
            $insArr[$key] = str_replace(",", "", $o->escape($value));
        } else {
            $insArr[$key] = $o->escape($value);
        }
    }
    $insArr['timeadded'] = time();
    $insArr['imageurl'] = 'data:image/png;base64,' . base64_encode(file_get_contents($_FILES['imageurl']['tmp_name']));
    unset($insArr['submit']);
    $o->insert("startups", $insArr);
    // header("Location: index.php");
}
require 'header.php';
?>
	<script src="http://clouddelivery.textbox.io/1/getEditor?apiKey=838eacr76gusx262p3cs4fwkjk104wsqun1nyelzulvy6okw"></script>
	<style type="text/css">
	textarea {
    	margin:10px 0;
    	height:500px;
    	width: 60%;
	}
	</style>
	<center>
		<h3>Add your startup</h3>
		<form method="POST" enctype="multipart/form-data">
开发者ID:ananay,项目名称:seedup,代码行数:31,代码来源:add.php


注:本文中的MysqliDb::insert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。