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


PHP MysqliDb::getLastError方法代码示例

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


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

示例1: array

                     break;
             }
         }
     }
     $query = $bd->getOne(TABLA_CATEGORIA);
     $arr = array(RESPUESTA_DATA => $query, RESPUESTA_MENSAJE => MENSAJE_OK, RESPUESTA_ERROR => ERROR_NINGUNO);
 } else {
     if ($accion_form == ACCION_AGREGAR) {
         $data_post = $postdata->form_data;
         if (!isset($data_post->FOTO)) {
             $data_post->FOTO = NULL;
         }
         $datos = array(COLUMNA_NOMBRE => $data_post->NOMBRE, COLUMNA_DESCRIPCION => $data_post->DESCRIPCION, COLUMNA_ESTADO => $data_post->ESTADO, COLUMNA_FOTO => $data_post->FOTO);
         $id_nuevo = $bd->insert(TABLA_CATEGORIA, $datos);
         if (!$id_nuevo) {
             $arr = array(RESPUESTA_ERROR => $bd->getLastError());
         } else {
             $datos[COLUMNA_ID] = $id_nuevo;
             $arr = array(RESPUESTA_DATA => $datos, RESPUESTA_MENSAJE => MENSAJE_OK, RESPUESTA_ERROR => ERROR_NINGUNO);
         }
     } else {
         if ($accion_form == ACCION_EDITAR) {
             $data_post = $postdata->form_data;
             if (!isset($data_post->FOTO)) {
                 $data_post->FOTO = NULL;
             }
             $datos = array(COLUMNA_NOMBRE => $data_post->NOMBRE, COLUMNA_DESCRIPCION => $data_post->DESCRIPCION, COLUMNA_ESTADO => $data_post->ESTADO, COLUMNA_FOTO => $data_post->FOTO);
             $bd->where(COLUMNA_ID, $data_post->ID);
             $respuesta = $bd->update(TABLA_CATEGORIA, $datos);
             if (!$respuesta) {
                 $arr = array(RESPUESTA_ERROR => $bd->getLastError());
开发者ID:josue270193,项目名称:Catalogo,代码行数:31,代码来源:categoria.php

示例2: array

$attractioncount = $_POST['attractioncount'];
$postaction = $_POST['postaction'];
$trans_id = $_POST['trans_id'];
$attractions = array();
$i = 0;
while ($i <= $attractioncount) {
    array_push($attractions, rawurlencode($_POST['attraction' . $i]));
    $i++;
}
$loops = array();
$i = 1;
while ($i <= $loopcount) {
    $loops[$i]["name"] = $_POST['loop' . $i];
    $i++;
}
$data = array('trail_id' => $id, 'lang' => $lang, 'desc' => $desc, 'lighting' => $lighting, 'surface' => $surface, 'parking' => $parking, 'facilities' => $facilities, 'hours' => $hours, 'attractions' => addslashes(json_encode($attractions)), 'loops' => addslashes(json_encode($loops)));
if ($postaction == "update") {
    $db->where('id', $trans_id);
    if ($db->update('translations', $data)) {
        header("Location: " . $baseurl . "admin/translate/done.php?status=update&id=" . $id . "&lang=" . $lang);
    } else {
        echo 'update failed: ' . $db->getLastError();
    }
} else {
    $id = $db->insert('translations', $data);
    if ($id) {
        header("Location: " . $baseurl . "admin/translate/done.php?id=" . $id . "&lang=" . $lang);
    } else {
        echo 'insert failed: ' . $db->getLastError();
    }
}
开发者ID:jmayfiel,项目名称:prescriptiontrails,代码行数:31,代码来源:post.php

示例3: explode

    $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";
    echo '				<span class="form_hint">Either <b>First</b> OR <b>Full</b> name.</span>';
    echo '			</li>' . "\n";
    echo '			<li>' . "\n";
    echo '				<label><font color="black">Email:</font></label>' . "\n";
开发者ID:AlanBridgeman,项目名称:D-DTabletopWebapp,代码行数:31,代码来源:signup.php

示例4: MysqliDb

//Dropbox				
$accessToken = "mcWxFEgcVbIAAAAAAAACgctpLBLkmojYc8kXY4IJDgQvtBdKiPXaUBT5bRDoj9Mu";
$appInfo = dbx\AppInfo::loadFromJsonFile($includes . "vendor/dropbox-sdk/Dropbox/app-info.json");
$webAuth = new dbx\WebAuthNoRedirect($appInfo, "PHP-Example/1.0");
$dbxClient = new dbx\Client($accessToken, "PHP-Example/1.0");
$accountInfo = $dbxClient->getAccountInfo();
*/
$log->debug('Drobox Created');
/*******************************************************************************************************************************
********************************************************************************************************************************
														Check Database Connetion
********************************************************************************************************************************
*******************************************************************************************************************************/
$log->debug('Testing SQL Connetion');
$db = new MysqliDb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
if ($db->getLastError() == null) {
    $log->error("Failed to connect to MySQL: " . $db->getLastError());
    //failed();
    exit;
}
$log->info('We have a good SQL Connetion');
/*******************************************************************************************************************************
********************************************************************************************************************************
														CREATE CSV
********************************************************************************************************************************
*******************************************************************************************************************************/
$log->debug('Creating CSV');
//FULL CSV Path
$CVSFilePath = $CSVFileLocation . $CSVfileName;
//Delete old file CSV file
$log->debug('Deleting old CSV File');
开发者ID:andywgarcia,项目名称:campuslifeohs,代码行数:31,代码来源:createCSV.php

示例5: saveNoticia

function saveNoticia($noticia)
{
    $db = new MysqliDb();
    $decoded = json_decode($noticia);
    $data = array("titulo" => $decoded->titulo, "detalles" => $decoded->detalle, "creador_id" => $decoded->creador_id, "vistas" => 0, "tipo" => $decoded->tipo);
    $results = $db->insert('noticias', $data);
    if ($results < 0) {
        echo json_encode($db->getLastError());
        return;
    }
    foreach ($decoded->fotos as $row) {
        $data = array("noticia_id" => $row["noticia_id"], "foto" => $row["foto"], "main" => $row["main"]);
        $results = $db->insert('noticias_fotos', $data);
        if ($results < 0) {
            echo json_encode($db->getLastError());
            return;
        }
    }
    echo json_encode(1);
}
开发者ID:arielcessario,项目名称:ac-angular-noticias,代码行数:20,代码来源:noticias.php

示例6: 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

示例7: MysqliDb

$params = array_merge(require __DIR__ . '/config.php');
$db = new MysqliDb($params['db_config']);
$sount = 0;
$i = 0;
$Error = '';
$neworderarray['0'] = "";
$neworderarray = array_merge($neworderarray, $_POST['neworder']);
unset($neworderarray['0']);
//loop through the list of ids and update your db
foreach ($neworderarray as $order => $id) {
    $data = array('sort' => $order);
    $db->where('id', $id);
    if ($db->update('sob', $data)) {
        $count++;
    } else {
        $Error = $Error . '' . $db->getLastError();
    }
    $i++;
}
if ($count != $i) {
    echo $Error;
} else {
    $sob = dbObject::table('sob')->get();
    $db->orderBy("sort", "asc");
    $sob = sob::get();
    foreach ($sob as $s) {
        $m[] = round($s->kef, 2);
    }
    echo '1-2 :' . round($m['0'] * $m['1'], 2) . '<br />';
    echo '3-4 :' . round($m['2'] * $m['3'], 2) . '<br />';
    echo '1-3 :' . round($m['0'] * $m['2'], 2) . '<br />';
开发者ID:polumerk,项目名称:fczb_stav,代码行数:31,代码来源:sort.php

示例8: 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

示例9: setAttr

 public function setAttr($id, $attribute)
 {
     $db = new MysqliDb(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
     $db->where("id", $id);
     if ($db->has("users")) {
         $db->where('id', $id);
         $user = $db->getOne("users");
         if (empty($user['data'])) {
             $data = $attribute;
         } else {
             $userData = json_decode($user['data'], true);
             $data = array_merge($userData, $attribute);
         }
         $newData = array("data" => json_encode($data));
         $db->where('id', $id);
         if ($db->update('users', $newData)) {
             return true;
         } else {
             return 'update failed: ' . $db->getLastError();
         }
     } else {
         return false;
     }
 }
开发者ID:jmayfiel,项目名称:prescriptiontrails,代码行数:24,代码来源:auth.php

示例10: MysqliDb

<?php

header('Content-type: text/html; charset=utf-8');
if (isset($_POST['sob'])) {
    require __DIR__ . '/vendor/autoload.php';
    $params = array_merge(require __DIR__ . '/config.php');
    $db = new MysqliDb($params['db_config']);
    foreach ($_POST['sob'] as $key => $value) {
        $id_sob = $key;
        foreach ($value as $val => $a) {
            $data[$val] = str_replace(',', '.', $a);
        }
        $db->where('id', $id_sob);
        if ($db->update('sob', $data)) {
            echo "Успешно обновлена запись ({$data['com']},{$data['kef']}). <br />";
        } else {
            echo "Ошибка при обновлении ({$data['com']},{$data['kef']}). Error: " . $db->getLastError();
        }
    }
}
开发者ID:polumerk,项目名称:fczb_stav,代码行数:20,代码来源:up_sob.php

示例11: explode

$difficulty = $_POST['difficulty'];
$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++;
}
$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);
$db->where('id', $_POST['id']);
if ($db->update('trails', $data)) {
    header("Location: " . $baseurl . "admin/new/done.php?type=update&id=" . $_POST['id']);
} else {
    return 'update failed: ' . $db->getLastError();
}
开发者ID:jmayfiel,项目名称:prescriptiontrails,代码行数:31,代码来源:update.php


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