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


PHP MySQL::Error方法代码示例

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


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

示例1: array

 function __construct($connect = true, $database = null, $server = null, $username = null, $password = null, $charset = "utf8", $port = null)
 {
     parent::__construct($connect, $database, $server, $username, $password, $charset, $port);
     if (parent::Error()) {
         parent::Kill();
     }
     $this->ErrorMsgs = array();
 }
开发者ID:aliihaidar,项目名称:pso,代码行数:8,代码来源:form.class.php

示例2: QueryBuilder

 /**
  * @see Element
  */
 function __construct($id = null, $params = "*", $key_name = null, $table_name = null, $md5 = false)
 {
     global $db;
     $this->querybuilder = new QueryBuilder();
     //print_r($this->querybuilder);
     $this->return = array();
     if (!is_null($key_name)) {
         $this->key = $key_name;
     }
     if (!is_null($table_name)) {
         $this->table = $table_name;
     }
     $this->return["success"] = false;
     $db = new MySQL(true, "test", "localhost", "root", "");
     //$db = new MySQL(true,DB_HOST,DB_NAME,DB_PASSWORD,DB_USER);
     if ($db->Error()) {
         $this->return["message"] = "Errore";
     }
     if ($id == null && $params != "*") {
         $this->create($params);
     } else {
         $this->updateParams($id, $params, $md5);
     }
 }
开发者ID:Zanej,项目名称:cms,代码行数:27,代码来源:DbElement.php

示例3: define

    $_FILES = $HTTP_POST_FILES;
}
if (!isset($_SERVER)) {
    $_SERVER = $HTTP_SERVER_VARS;
}
if (!isset($_SESSION)) {
    $_SESSION = $HTTP_SESSION_VARS;
}
if (!isset($_POST)) {
    $_POST = $HTTP_POST_VARS;
}
if (!isset($_GET)) {
    $_GET = $HTTP_GET_VARS;
}
if ($_SERVER['REMOTE_ADDR'] == '127.0.0.1') {
    #echo "LAVORO LOCALE";
    define("DB_HOST", '192.168.0.15');
    define("DB_USER", 'sil_booking');
    define("DB_PASSWORD", 'lignano');
    define("DB_NAME", 'kicero');
} else {
}
define("VAT_VALUE", 22);
define("VAT_VALUE_X", 1.22);
require_once dirname(__FILE__) . '/config.inc.php';
require_once dirname(__FILE__) . '/db.class.inc.php';
#require_once dirname(__FILE__).'/ezmc.class.inc.php';
$db = new MySQL(true, DB_NAME, DB_HOST, DB_USER, DB_PASSWORD);
if ($db->Error()) {
    $db->Kill("Errore connessione a DB");
}
开发者ID:Zanej,项目名称:cms,代码行数:31,代码来源:db_connection.php

示例4:

$tables = $db->GetTables();
foreach ($tables as $table) {
    echo $table . "<br />\n";
}
// --- Show the columns (field names) in a table --------------------
$columns = $db->GetColumnNames("test");
foreach ($columns as $column) {
    echo $column . "<br />\n";
}
// --- Find a column (field) type and length ------------------------
echo "Type: " . $db->GetColumnDataType("Color", "Test") . "<br />\n";
echo "Length: " . $db->GetColumnLength("Color", "Test") . "<br />\n";
// --- Get a column's ordinal position (the column number) ----------
echo $db->GetColumnID("Age", "Test") . "<br />\n";
// --- Check for errors ---------------------------------------------
if ($db->Error()) {
    echo "<h3>" . $db->Error() . "</h3>\n";
} else {
    echo "<p>There were no errors</p>\n";
}
// --- Format some values ready for SQL -----------------------------
// You do not have to create the object to use these. Simply include
// the class in your PHP file. These are called "Static" methods.
echo "<br /><br />\n\n";
echo MySQL::SQLValue("Let's format some text") . "<br />\n";
echo MySQL::SQLValue(date("m/d/Y"), MySQL::SQLVALUE_DATE) . "<br />\n";
echo MySQL::SQLValue(123, MySQL::SQLVALUE_NUMBER) . "<br />\n";
// --- Format some values ready for SQL based on a boolean value ----
echo MySQL::SQLBooleanValue(false, "1", "0", MySQL::SQLVALUE_NUMBER);
echo MySQL::SQLBooleanValue("ON", "Ya", "Nope");
echo MySQL::SQLBooleanValue(1, '+', '-');
开发者ID:kimai,项目名称:kimai,代码行数:31,代码来源:example.php

示例5: while

 if (!$db->Query($fullquery)) {
     $db->Kill($db->Error());
 }
 $nbrlocalreq = $db->RowCount();
 while (!$db->EndOfSeek()) {
     $row = $db->Row();
     $dbd->Query($row->req);
 }
 $db->Query("update temprequet set stat=1 where stat=0");
 // ---------------------------------------------------
 // Execute Remote requete on locoal server
 // ---------------------------------------------------
 global $db;
 $fullquery = "SELECT req,id from temprequet where stat=0 ";
 if (!$dbd->Query($fullquery)) {
     $dbd->Kill($dbd->Error());
 }
 $nbrremotreq = $dbd->RowCount();
 while (!$dbd->EndOfSeek()) {
     $row = $dbd->Row();
     if (!$db->Query($row->req)) {
         $db->Kill($db->Error());
     } else {
         $dbd->Query("update temprequet set stat=1 where id=" . $row->id);
     }
 }
 // ---------------------------------------------------
 // Insert log Last update
 // ---------------------------------------------------
 $nbrreq = $nbrlocalreq + $nbrremotreq;
 $lastmaj = "Insert into maj_sys(nbrreq,user)values({$nbrreq}," . $_SESSION['userid'] . ")";
开发者ID:ATS001,项目名称:MRN,代码行数:31,代码来源:sync_c.php

示例6: MySQL

<?php

include "../user/config.php";
include "../core/includes/class/mysql.class.php";
$db = new MySQL(false, $sql_dbname, $sql_host, $sql_user, $sql_pass, $sql_charset, $sql_pcon);
$db->Open();
$result = $db->Query("CREATE TABLE IF NOT EXISTS `ac_global` (\n\t\t`player_identifier` int(11) NOT NULL AUTO_INCREMENT,\n\t\t`player_auth` varchar(36) COLLATE utf8_unicode_ci NOT NULL,\n\t\t`total_tokens` int(11) NOT NULL,\n\t\t`name` varchar(32) COLLATE utf8_unicode_ci NOT NULL,\n\t\tPRIMARY KEY (`player_identifier`),\n\t\tUNIQUE KEY `player_auth` (`player_auth`)\n\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;");
if (!$result) {
    die("MySQL: " . $db->Error() . "");
}
foreach ($servers as $k => $unimportant) {
    $result = $db->Query("CREATE TABLE IF NOT EXISTS `ac_{$k}_list` (\n\t\t\t`id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t`name` varchar(64) NOT NULL,\n\t\t\t`desc` varchar(256) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,\n\t\t\t`value_id` varchar(32) NOT NULL,\n\t\t\t`icon` varchar(256) NOT NULL,\n\t\t\t`available` int(11) NOT NULL DEFAULT '1',\n\t\t\t`value` int(11) NOT NULL DEFAULT '0',\n\t\t\t`tokens` int(11) NOT NULL DEFAULT '0',\n\t\t\t`max` int(11) NOT NULL DEFAULT '0',\n\t\t\t`created` int(11) NOT NULL DEFAULT '0',\n\t\t\t`cat` int(11) NOT NULL DEFAULT '0',\n\t\t\tPRIMARY KEY (`id`),\n\t\t\tUNIQUE KEY `id` (`id`)\n\t\t) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;");
    if (!$result) {
        die("There was an error processing the SQL query. Check if any of the server shorts in config file are incorrect. Only alphanumeric values are allowed.");
    }
    $result = $db->Query("CREATE TABLE IF NOT EXISTS `ac_{$k}_data` (\n\t\t\t `player_auth` varchar(64) COLLATE utf8_unicode_ci NOT NULL,\n\t\t\t\t`value_id` varchar(32) CHARACTER SET latin1 NOT NULL,\n\t\t\t\t`value_status` int(11) NOT NULL,\n\t\t\t\t`value_extra` int(11) NOT NULL,\n\t\t\t\tPRIMARY KEY (`player_auth`,`value_id`),\n\t\t\t\tKEY `player_auth` (`player_auth`)\n\t\t) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;");
    if (!$result) {
        die("There was an error processing the SQL query. Check if any of the server shorts in config file are incorrect. Only alphanumeric values are allowed.");
    }
    $result = $db->Query("CREATE TABLE IF NOT EXISTS `ac_{$k}_cats` (\n\t\t\t`cat_id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t`cat_name` varchar(32) NOT NULL,\n\t\t\tPRIMARY KEY (`cat_id`),\n\t\t\tUNIQUE KEY `cat_id` (`cat_id`)\n\t\t) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;");
    if (!$result) {
        die("There was an error processing the SQL query. Check if any of the server shorts in config file are incorrect. Only alphanumeric values are allowed.");
    }
}
echo "All missing tables (if there were any) were successfully created.";
开发者ID:shoaib,项目名称:Achievements,代码行数:25,代码来源:create_tables.php

示例7: logLastError

 /**
  * @param string $scope
  */
 private function logLastError($scope)
 {
     Kimai_Logger::logfile($scope . ': ' . $this->conn->Error());
 }
开发者ID:kimai,项目名称:kimai,代码行数:7,代码来源:Mysql.php

示例8: MySQL

            $kga['server_password'] = $server_ext_password[$dbnr];
        }
        if ($server_ext_prefix[$dbnr] != '') {
            $kga['server_prefix'] = $server_ext_prefix[$dbnr];
        }
    }
} else {
    if (isset($_COOKIE['kimai_db']) && $_COOKIE['kimai_db'] == true) {
        $dbnr = $_COOKIE['kimai_db'] - 1;
        $kga['server_database'] = $server_ext_database[$dbnr];
        if ($server_ext_username[$dbnr] != '') {
            $kga['server_username'] = $server_ext_username[$dbnr];
        }
        if ($server_ext_password[$dbnr] != '') {
            $kga['server_password'] = $server_ext_password[$dbnr];
        }
        if ($server_ext_prefix[$dbnr] != '') {
            $kga['server_prefix'] = $server_ext_prefix[$dbnr];
        }
    }
}
// ===========================================================================
include WEBROOT . "libraries/mysql.class.php";
if (isset($utf8) && $utf8) {
    $conn = new MySQL(true, $kga['server_database'], $kga['server_hostname'], $kga['server_username'], $kga['server_password'], "utf-8");
} else {
    $conn = new MySQL(true, $kga['server_database'], $kga['server_hostname'], $kga['server_username'], $kga['server_password']);
}
if ($conn->Error()) {
    $conn->Kill();
}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:31,代码来源:connect_mysql.php

示例9: MySQL

 //
 // Installation actions
 //  - Set collected data
 //
 // Let's start with a clean sheet
 $err = 0;
 // Include MySQL class && initiate
 /*MARKER*/
 require_once BASE_PATH . '/lib/class/mysql.class.php';
 $db = new MySQL();
 //
 // Try database connection
 //
 if (!$db->Open(null, $_SESSION['variables']['db_host'], $_SESSION['variables']['db_user'], $_SESSION['variables']['db_pass'], 'utf8', 'utf8_unicode_ci')) {
     $errors[] = 'Error: could not connect to the database engine';
     $errors[] = $db->Error();
     $errors[] = $db->MyDyingMessage();
     $err++;
 } else {
     $log[] = "Database engine connection successful";
 }
 //
 // Either Select the database or create it when it does not exist yet
 //
 if (!$db->SelectDatabase($_SESSION['variables']['db_name'])) {
     if (!$db->CreateDatabase($_SESSION['variables']['db_name'])) {
         $errors[] = 'Error: could not create the database "' . $_SESSION['variables']['db_name'] . '"';
         $errors[] = $db->Error();
         $errors[] = $db->MyDyingMessage();
         $err++;
     } else {
开发者ID:GerHobbelt,项目名称:CompactCMS,代码行数:31,代码来源:installer.inc.php

示例10:

    $where .= " ( employee_name LIKE '" . $params['search']['value'] . "%' ";
    $where .= " OR employee_salary LIKE '" . $params['search']['value'] . "%' ";
    $where .= " OR employee_age LIKE '" . $params['search']['value'] . "%' )";
}
// getting total number records without any search
$sql = "SELECT * FROM `employee` ";
$sqlTot .= $sql;
$sqlRec .= $sql;
//concatenate search sql if value exist
if (isset($where) && $where != '') {
    $sqlTot .= $where;
    $sqlRec .= $where;
}
$sqlRec .= " ORDER BY " . $columns[$params['order'][0]['column']] . "   " . $params['order'][0]['dir'] . "  LIMIT " . $params['start'] . " ," . $params['length'] . " ";
if (!$db->Query($sqlTot)) {
    $db->Kill($db->Error());
}
//$queryTot = mysqli_query($conn, $sqlTot) or die("database error:". mysqli_error($conn));
$totalRecords = $db->RowCount();
//$totalRecords = mysqli_num_rows($queryTot);
if (!$db->Query($sqlRec)) {
    $db->Kill($db->Error());
}
//$queryRecords = mysqli_query($conn, $sqlRec) or die("error to fetch employees data");
//iterate on results row and create new index array of data
while (!$db->EndOfSeek()) {
    $row = $db->RowValue();
    $data[] = $row;
}
//while( $row = mysqli_fetch_row($queryRecords) ) {
//$data[] = $row;
开发者ID:ATS001,项目名称:PRSIT,代码行数:31,代码来源:response.php

示例11: exit

<?php

/** 
 * Xử lý kết nối database
 * Vị trí : hm_include/database.php 
 */
if (!defined('BASEPATH')) {
    exit('403');
}
/**
 * Gọi thư viện mysql
 */
require_once BASEPATH . HM_INC . '/database/mysql.php';
/**
 * Kết nối mysql
 */
$hmdb = new MySQL(true, DB_NAME, DB_HOST, DB_USER, DB_PASSWORD, DB_CHARSET);
if (!$hmdb->IsConnected()) {
    exit('Không thể kết nối đến cơ sở dữ liệu');
} else {
    if ($hmdb->Error()) {
        exit($hmdb->Kill());
    }
    $hmdb->Query('SET NAMES "UTF8"');
}
开发者ID:butkimtinh,项目名称:hoamai-cms-beta-1.0,代码行数:25,代码来源:database.php

示例12: MySQL

<?php

include "../user/config.php";
include "../core/includes/class/mysql.class.php";
$db = new MySQL(false, $sql_dbname, $sql_host, $sql_user, $sql_pass, $sql_charset, $sql_pcon);
$db->Open();
foreach ($servers as $k => $unimportant) {
    $result = $db->Query("ALTER IGNORE TABLE  `ac_{$k}_plrdata` ADD COLUMN  `plrid` INT NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (  `plrid` )");
    if ($result) {
        echo "Done adding column plrid to table ac_{$k}_plrdata.<br>";
    } else {
        echo "There was a problem adding column plrid to table ac_{$k}_plrdata. MySQL says: <i>";
        echo $db->Error();
        echo "</i><br>";
    }
}
开发者ID:shoaib,项目名称:Achievements,代码行数:16,代码来源:add_plrdata_plrid.php


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