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


PHP medoo::error方法代码示例

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


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

示例1: throwMysqlError

 protected function throwMysqlError()
 {
     $errorMsg = "MySQL error occurred. ";
     if (EMA_DEBUG === true) {
         $errorArray = $this->dbConnection->error();
         $errorMsg .= " Debug Data:  " . $errorArray[2];
     }
     throw new \Exception($errorMsg, 6022);
 }
开发者ID:indiwine,项目名称:EMA-engine,代码行数:9,代码来源:RootClass.php

示例2: error

 /**
  * @return array
  */
 public function error()
 {
     $rt = array('write' => $this->_writer->error(), 'read' => NULL);
     if (empty($this->_reader)) {
         $rt['read'] = $rt['write'];
     } else {
         $rt['read'] = $this->_reader->error();
     }
     return $rt;
 }
开发者ID:dalinhuang,项目名称:StudentManage,代码行数:13,代码来源:sql.php

示例3: getAjaxMethods

 public function getAjaxMethods()
 {
     $whereClause = $this->getRPCWhere($this->currentClass);
     $dbData = $this->dbQuery(array('AND' => $whereClause));
     if (is_array($dbData) === false) {
         $errorMsg = "Cannot get data from db.";
         if (EMA_DEBUG === true) {
             $errorArray = $this->dbConnection->error();
             $errorMsg .= " Debug Data:  " . $errorArray[2];
         }
         throw new FatalError($errorMsg, 6022);
     }
     if (count($dbData) === 0) {
         return false;
     }
     $methodsArray = array();
     foreach ($dbData as $method) {
         $methodsArray[] = $method['methodName'];
     }
     return $methodsArray;
 }
开发者ID:indiwine,项目名称:EMA-engine,代码行数:21,代码来源:GroupPolicy.php

示例4: getHtml

ini_set('display_errors', 'ON');
error_reporting(E_ALL);
header("Content-type:text/html;charset=utf-8");
defined('ROOT_PATH') or define('ROOT_PATH', dirname(__FILE__));
include ROOT_PATH . '/../lib/medoo.php';
include ROOT_PATH . '/../lib/Curl.php';
$db = new medoo(array('database_type' => 'mysql', 'database_name' => 'fayuan', 'server' => 'localhost', 'username' => 'root', 'password' => '123456', 'port' => 3306, 'charset' => 'utf8', 'option' => array(PDO::ATTR_CASE => PDO::CASE_NATURAL)));
$curl = new Curl();
$id = 2250;
while ($id <= 1239000) {
    $url = "http://shixin.court.gov.cn/detail?id={$id}";
    $resArr = getHtml($url);
    echo "{$id}\r\n";
    if (is_array($resArr) && !empty($resArr)) {
        //判断数据是否存在
        print_r($resArr);
        $i = $db->insert('shixin', $resArr);
        if ($i <= 0) {
            print_r($db->error());
            die;
        }
    }
    $id++;
}
function getHtml($url)
{
    global $curl;
    $curl->setUrl($url);
    $html = $curl->run();
    return json_decode($html, true);
}
开发者ID:playgamelxh,项目名称:lxh,代码行数:31,代码来源:shixin.php

示例5: medoo

<?php

// phpinfo();
require 'vendor/autoload.php';
$db = new medoo(['database_type' => 'mysql', 'database_name' => 'test', 'server' => 'localhost', 'username' => 'root', 'password' => '', 'option' => [PDO::ATTR_CASE => PDO::CASE_NATURAL]]);
$r = $db->insert("user", []);
var_dump($r);
var_dump($db->log());
var_dump($db->error());
开发者ID:Walk4Muscle,项目名称:garyslim3,代码行数:9,代码来源:phpinfo.php

示例6: medoo

<?php

require_once '../vendor/autoload.php';
echo "Hello World";
$file = '../storage/database.db';
if (is_writable('../storage/database.local.db')) {
    $file = '../storage/database.local.db';
}
$database = new medoo(['database_type' => 'sqlite', 'database_file' => '../storage/database.db']);
$comment = new SitePoint\Comment($database);
$comment->setEmail('bruno@skvorc.me')->setName('Bruno Skvorc')->setComment('It works!')->setComment('Hooray! Saving comments works!')->save();
dump($database->error());
?>

<!doctype html>
<html class="no-js" lang="">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="x-ua-compatible" content="ie=edge">
        <title></title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <link rel="apple-touch-icon" href="apple-touch-icon.png">
        <!-- Place favicon.ico in the root directory -->

        <link rel="stylesheet" href="css/normalize.css">
        <link rel="stylesheet" href="css/main.css">
        <script src="js/vendor/modernizr-2.8.3.min.js"></script>
    </head>
    <body>
开发者ID:yazhini04,项目名称:phpenv1-example,代码行数:31,代码来源:index.php

示例7: dbHasError

<?php

defined("TEMPLATES_PATH") or define("TEMPLATES_PATH", realpath(dirname(__FILE__) . '/view'));
defined("LIBRARY_PATH") or define("LIBRARY_PATH", realpath(dirname(__FILE__) . '/lib'));
include LIBRARY_PATH . '/medoo.min.php';
if (isset($_GET['install']) and !file_exists(LIBRARY_PATH . '/database.db') and isset($_POST['username']) and isset($_POST['pwd']) and isset($_POST['rpt']) and $_POST['pwd'] == $_POST['rpt']) {
    $db = new medoo(LIBRARY_PATH . '/database.db');
    $db->query("CREATE TABLE users (username TEXT,password TEXT);");
    $db->query("CREATE TABLE settings (setting TEXT,value TEXT);");
    $db->query("CREATE TABLE hosts (domain TEXT,checkInTime TEXT,description TEXT);");
    $db->insert("users", ["username" => strtolower($_POST['username']), "password" => password_hash($_POST['pwd'], PASSWORD_DEFAULT)]);
    $db->insert("settings", ["setting" => "secretKey", "value" => rand()]);
    if (!$db->error()[0] == "00000") {
        unlink(LIBRARY_PATH . '/database.db');
        $noticeMessage = "An error occurred while saving the database.";
    } else {
        $noticeMessage = "Successfully installed DropPoint control. Please login.";
    }
}
if (!file_exists(LIBRARY_PATH . '/database.db')) {
    include TEMPLATES_PATH . '/setup.php';
    exit;
}
$db = new medoo(LIBRARY_PATH . '/database.db');
$secretCode = $db->get("settings", "value", ["setting" => "secretKey"]);
function dbHasError()
{
    global $db;
    if ($db->error()[0] == "00000") {
        return false;
    } else {
开发者ID:bhassani,项目名称:dropPoint,代码行数:31,代码来源:droppoint.php

示例8: function

        $app->render(200, ['line' => $line]);
    }
});
// Delete Invoice
$app->delete('/api/invoices/:id', 'APIrequest', function ($id) use($app) {
    // Connect
    global $dbCredentials;
    $database = new medoo($dbCredentials);
    // Insert
    $database->delete('invoice', ['id' => $id]);
    $error = $database->error();
    if ($error[1]) {
        $app->render(500, ['error' => true, 'message' => $error[2], 'query' => $database->last_query()]);
    } else {
        $app->render(200, ['message' => 'deleted']);
    }
});
// Delete Invoice Line
$app->delete('/api/invoices/:invoice_id/lines/:line_id', 'APIrequest', function ($invoice_id, $line_id) use($app) {
    // Connect
    global $dbCredentials;
    $database = new medoo($dbCredentials);
    // Insert
    $database->delete('line', ['AND' => ['id' => $line_id, 'invoice_id' => $invoice_id]]);
    $error = $database->error();
    if ($error[1]) {
        $app->render(500, ['error' => true, 'message' => $error[2], 'query' => $database->last_query()]);
    } else {
        $app->render(200, ['message' => 'deleted']);
    }
});
开发者ID:scriptist,项目名称:invoice.scripti.st,代码行数:31,代码来源:admin-api.php


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