• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP mysqli_real_query函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中mysqli_real_query函数的典型用法代码示例。如果您正苦于以下问题:PHP mysqli_real_query函数的具体用法?PHP mysqli_real_query怎么用?PHP mysqli_real_query使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: delete

 function delete($tabloAdi, $kosul)
 {
     $sql = "DELETE FROM " . $tabloAdi . " WHERE " . $kosul;
     if (!mysqli_real_query($this->baglantiNo, $sql)) {
         throw new DBException("Silme sorgusunda sorun var...");
     }
 }
开发者ID:GULSENCIMEN,项目名称:projeler,代码行数:7,代码来源:ClassVeritabaniMysqli.php


示例2: execute_bool

function execute_bool($link, $query)
{
    $bool = mysqli_real_query($link, $query);
    if (mysqli_errno($link)) {
        exit(mysqli_error($link));
    }
    return $bool;
}
开发者ID:sakuraliu,项目名称:bbs,代码行数:8,代码来源:mysql.inc.php


示例3: mysql_unbuffered_query

 function mysql_unbuffered_query($query, \mysqli $link = null)
 {
     $link = \Dshafik\MySQL::getConnection($link);
     if (mysqli_real_query($link, $query)) {
         return mysqli_use_result($link);
     }
     return false;
 }
开发者ID:muhammedalialat,项目名称:php7-mysql-shim,代码行数:8,代码来源:mysql.php


示例4: istable

function istable($table)
{
    global $mysqli;
    mysqli_real_query($mysqli, "SELECT 1 FROM `{$table}` LIMIT 1 ");
    mysqli_use_result($mysqli);
    if (mysqli_errno($mysqli) == 1146) {
        return false;
    } else {
        return true;
    }
}
开发者ID:KunalT6569,项目名称:opinion-mining,代码行数:11,代码来源:mfunctions.php


示例5: mysqli_query_select_varchar_unbuffered

function mysqli_query_select_varchar_unbuffered($type, $len, $runs, $rows, $host, $user, $passwd, $db, $port, $socket, $flag_original_code)
{
    $errors = $times = array();
    foreach ($rows as $k => $num_rows) {
        foreach ($runs as $k => $run) {
            $times[$num_rows . ' rows: SELECT ' . $type . ' ' . $run . 'x overall'] = microtime(true);
            do {
                if (!($link = @mysqli_connect($host, $user, $passwd, $db, $port, $socket))) {
                    $errors[] = sprintf("%d rows: SELECT %s %dx connect failure (original code = %s)", $num_rows, $type, $run, $flag_original_code ? 'yes' : 'no');
                    break 3;
                }
                if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
                    $errors[] = sprintf("%d rows: SELECT %s %dx drop table failure (original code = %s): [%d] %s", $num_rows, $type, $run, $flag_original_code ? 'yes' : 'no', mysqli_errno($link), mysqli_error($link));
                    break 3;
                }
                if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, label %s)", $type))) {
                    $errors[] = sprintf("%d rows: SELECT %s %dx create table failure (original code = %s): [%d] %s", $num_rows, $type, $run, $flag_original_code ? 'yes' : 'no', mysqli_errno($link), mysqli_error($link));
                    break 3;
                }
                $label = '';
                for ($i = 0; $i < $len; $i++) {
                    $label .= chr(mt_rand(65, 90));
                }
                $label = mysqli_real_escape_string($link, $label);
                for ($i = 1; $i <= $num_rows; $i++) {
                    if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES ({$i}, '{$label}')")) {
                        $errors[] = sprintf("%d rows: SELECT %s %dx insert failure (original code = %s): [%d] %s", $num_rows, $type, $run, $flag_original_code ? 'yes' : 'no', mysqli_errno($link), mysqli_error($link));
                        break 3;
                    }
                }
                for ($i = 0; $i < $run; $i++) {
                    $start = microtime(true);
                    mysqli_real_query($link, "SELECT id, label FROM test");
                    $res = mysqli_use_result($link);
                    $times[$num_rows . ' rows: SELECT ' . $type . ' ' . $run . 'x query()'] += microtime(true) - $start;
                    if (!$res) {
                        $errors[] = sprintf("%d rows: SELECT %s %dx insert failure (original code = %s): [%d] %s", $rows, $type, $run, $flag_original_code ? 'yes' : 'no', mysqli_errno($link), mysqli_error($link));
                        break 4;
                    }
                    $start = microtime(true);
                    while ($row = mysqli_fetch_assoc($res)) {
                    }
                    $times[$num_rows . ' rows: SELECT ' . $type . ' ' . $run . 'x fetch_assoc()'] += microtime(true) - $start;
                }
                mysqli_close($link);
            } while (false);
            $times[$num_rows . ' rows: SELECT ' . $type . ' ' . $run . 'x overall'] = microtime(true) - $times[$num_rows . ' rows: SELECT ' . $type . ' ' . $run . 'x overall'];
        }
    }
    return array($errors, $times);
}
开发者ID:splitice,项目名称:mysqlnd_ms,代码行数:51,代码来源:mysqli_sel_unbuf.php


示例6: __construct

 public function __construct($cfg)
 {
     $link = @mysqli_connect($cfg['dbserver'], $cfg['dbuser'], $cfg['dbpass'], $cfg['dbname']);
     if ($link) {
         $this->linkid = $link;
         $this->connected = true;
         if (!empty($cfg['dbcharset'])) {
             mysqli_real_query($link, "SET NAMES '{$cfg['dbcharset']}'");
         }
     } else {
         $this->errnum = mysqli_connect_errno();
         $this->error = mysqli_connect_error();
     }
 }
开发者ID:CatBerg-TestOrg,项目名称:coppermine,代码行数:14,代码来源:dbase.inc.php


示例7: query

 function query($query)
 {
     $args = array();
     if (is_array($query)) {
         $args = $query;
         // only use arg 1
     } else {
         $args = func_get_args();
     }
     $query = $this->_format_query($args);
     $this->querycount++;
     if (isset($this->get['debug'])) {
         $this->debug($query);
     }
     mysqli_real_query($this->connection, $query) or error(QUICKSILVER_QUERY_ERROR, mysqli_error($this->connection), $query, mysqli_errno($this->connection));
     return mysqli_store_result($this->connection);
 }
开发者ID:BackupTheBerlios,项目名称:qsf-svn,代码行数:17,代码来源:mysqli.php


示例8: executeMultiNoresSQL

 /**
  * Transaction style - runs queries in order
  *
  * @since 08.05.2011
  * Refactored for using $this::mysqli_connection instead of mysqli_init/mysqli_close
  */
 public function executeMultiNoresSQL(&$queryArry)
 {
     $link = $this->getMysqliConnection();
     /* set autocommit to off */
     mysqli_autocommit($link, FALSE);
     $all_query_ok = true;
     //do queries
     foreach ($queryArry as $query) {
         if (!mysqli_real_query($link, $query)) {
             $all_query_ok = false;
         }
     }
     if ($all_query_ok) {
         /* commit queries */
         mysqli_commit($link);
     } else {
         /* Rollback */
         mysqli_rollback($link);
     }
     /* set autocommit to on */
     mysqli_autocommit($link, TRUE);
     return $all_query_ok;
 }
开发者ID:sergrin,项目名称:crawlers-il,代码行数:29,代码来源:DBAdapter2.class.php


示例9: executeMultiNoresSQL

 public function executeMultiNoresSQL(&$queryArry)
 {
     $link = mysqli_init();
     if (!$link) {
         throw new DBAdapter2Exception("mysqli_init failed");
     }
     if (!mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT, 5)) {
         throw new DBAdapter2Exception("Setting MYSQLI_OPT_CONNECT_TIMEOUT failed");
     }
     if (!mysqli_real_connect($link, $this->host, $this->username, $this->password, $this->schema)) {
         throw new DBAdapter2Exception('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
     }
     if (!mysqli_set_charset($link, $this->charset)) {
         throw new DBAdapter2Exception('Error loading character set ' . $this->charset . ' - ' . mysqli_error($link));
     }
     /* set autocommit to off */
     mysqli_autocommit($link, FALSE);
     $all_query_ok = true;
     //do queries
     foreach ($queryArry as $query) {
         if (!mysqli_real_query($link, $query)) {
             $all_query_ok = false;
         }
     }
     if ($all_query_ok) {
         /* commit queries */
         mysqli_commit($link);
     } else {
         /* Rollback */
         mysqli_rollback($link);
     }
     /* set autocommit to on */
     mysqli_autocommit($link, TRUE);
     mysqli_close($link);
     return $all_query_ok;
 }
开发者ID:sergrin,项目名称:crawlers-il,代码行数:36,代码来源:DBAdapter2.class.php


示例10: str_replace

            $amount = str_replace(',', '.', $_POST['amount']);
        } else {
            exit('Fehler: Kosten');
        }
    } else {
        $amount = $_POST['amount'];
    }
    $query = 'UPDATE
                  costs_person
                SET
                  costs_person.year = \'' . $_POST['year'] . '\',
                  costs_person.usage = \'' . $post_usage . '\',
                  costs_person.amount = \'' . $amount . '\'
                WHERE
                  costs_person.id = ' . $_GET['param'];
    $result = mysqli_real_query($db, $query);
}
$query_costs = 'SELECT
                      costs_person.year, costs_person.usage, costs_person.amount
                    FROM
                      costs_person
                    WHERE costs_person.id =' . $_GET['param'];
$result_costs = mysqli_query($db, $query_costs);
mysqli_close($db);
echo '<body';
if ($result) {
    echo ' onload="window.opener.location.href=\'costs_person.php\'; window.close();"';
}
echo '>';
echo '<div class="head">
            <h1>Kosten pro Person ändern</h1>
开发者ID:Hoernchen20,项目名称:service-charges,代码行数:31,代码来源:costs_person_change.php


示例11: excel

	margin-bottom: 3em;
}
.left {
	
}
.right {
	width: 60%;
}
</style>
<h1>Ents Bookings</h1>
<p> Download in <a href="bookings_Spreadsheet.php">spreadsheet format</a>. This is a tab separated file. In order to import it into excel (or similar software) correctly, make sure the 'tab' box is the only box checked for the delimiters (comma, space, etc should be unchecked).</p>
<table>
<?php 
$cv = mysqli_connect("localhost", "mayball_admin", "XuthebAw97");
mysqli_select_db($cv, "mayball");
mysqli_real_query($cv, "SELECT ents_slots.*,ents.* FROM ents INNER JOIN ents_slots ON ents.ents_slot_id=ents_slots.ents_slot_id ORDER BY ents_slots.time;");
if ($result = mysqli_use_result($cv)) {
    while (($row = mysqli_fetch_assoc($result)) != null) {
        echo "<tr>";
        echo "<td class='left'>" . date("D jS M - g:i a", strtotime($row["time"])) . "</td>";
        echo "<td class='right'>";
        echo "<span class='label'>Act Name</span>: " . $row["act_name"] . "<br />";
        echo "<span class='label'>Act Type</span>: " . $row["act_type"] . "<br />";
        echo "<span class='label'>Genre/Description</span>: <div id='genre'>" . nl2br($row["genre"]) . "</div><br />";
        echo "<span class='label'>Contact</span>: <a href='mailto:'" . $row["contact_email"] . "'>" . $row["contact_name"] . "</a> [" . $row["contact_phone"] . "] <br />";
        echo "</td>";
        echo "</tr>";
    }
}
mysqli_free_result($result);
?>
开发者ID:JJMinton,项目名称:2014JesusMayBall_frontpage,代码行数:31,代码来源:viewBookings.php


示例12: printf

<?php

require_once "connect.inc";
$tmp = NULL;
$link = NULL;
$test_table_name = 'test_mysqli_use_result_table_1';
require 'table.inc';
if (!($res = mysqli_real_query($link, "SELECT id, label FROM test_mysqli_use_result_table_1 ORDER BY id"))) {
    printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
if (!is_object($res = mysqli_use_result($link))) {
    printf("[004] Expecting object, got %s/%s. [%d] %s\n", gettype($res), $res, mysqli_errno($link), mysqli_error($link));
}
if (false !== ($tmp = mysqli_data_seek($res, 2))) {
    printf("[005] Expecting boolean/true, got %s/%s. [%d] %s\n", gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
}
mysqli_free_result($res);
if (!mysqli_query($link, "DELETE FROM test_mysqli_use_result_table_1")) {
    printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
if (false !== ($res = mysqli_use_result($link))) {
    printf("[007] Expecting boolean/false, got %s/%s. [%d] %s\n", gettype($res), $res, mysqli_errno($link), mysqli_error($link));
}
if (!($res = mysqli_query($link, "SELECT id, label FROM test_mysqli_use_result_table_1 ORDER BY id"))) {
    printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
if (false !== ($tmp = mysqli_data_seek($res, 1))) {
    printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
}
mysqli_close($link);
if (NULL !== ($tmp = mysqli_use_result($link))) {
开发者ID:alphaxxl,项目名称:hhvm,代码行数:31,代码来源:mysqli_use_result.php


示例13: phorum_db_interact

/**
 * This function is the central function for handling database interaction.
 * The function can be used for setting up a database connection, for running
 * a SQL query and for returning query rows. Which of these actions the
 * function will handle and what the function return data will be, is
 * determined by the $return function parameter.
 *
 * @param $return   - What to return. Options are the following constants:
 *                    DB_RETURN_CONN      a db connection handle
 *                    DB_RETURN_QUOTED    a quoted parameter
 *                    DB_RETURN_RES       result resource handle
 *                    DB_RETURN_ROW       single row as array
 *                    DB_RETURN_ROWS      all rows as arrays
 *                    DB_RETURN_ASSOC     single row as associative array
 *                    DB_RETURN_ASSOCS    all rows as associative arrays
 *                    DB_RETURN_VALUE     single row, single column
 *                    DB_RETURN_ROWCOUNT  number of selected rows
 *                    DB_RETURN_NEWID     new row id for insert query
 *                    DB_RETURN_ERROR     an error message if the query
 *                                        failed or NULL if there was no error
 *                    DB_CLOSE_CONN       close the connection, no return data
 *
 * @param $sql      - The SQL query to run or the parameter to quote if
 *                    DB_RETURN_QUOTED is used.
 *
 * @param $keyfield - When returning an array of rows, the indexes are
 *                    numerical by default (0, 1, 2, etc.). However, if
 *                    the $keyfield parameter is set, then from each
 *                    row the $keyfield index is taken as the key for the
 *                    return array. This way, you can create a direct
 *                    mapping between some id field and its row in the
 *                    return data. Mind that there is no error checking
 *                    at all, so you have to make sure that you provide
 *                    a valid $keyfield here!
 *
 * @param $flags    - Special flags for modifying the function's behavior.
 *                    These flags can be OR'ed if multiple flags are needed.
 *                    DB_NOCONNECTOK     Failure to connect is not fatal but
 *                                       lets the call return FALSE (useful
 *                                       in combination with DB_RETURN_CONN).
 *                    DB_MISSINGTABLEOK  Missing table errors not fatal.
 *                    DB_DUPFIELDNAMEOK  Duplicate field errors not fatal.
 *                    DB_DUPKEYNAMEOK    Duplicate key name errors not fatal.
 *                    DB_DUPKEYOK        Duplicate key errors not fatal.
 *
 * @return $res     - The result of the query, based on the $return parameter.
 */
function phorum_db_interact($return, $sql = NULL, $keyfield = NULL, $flags = 0)
{
    static $conn;
    // Close the database connection.
    if ($return == DB_CLOSE_CONN) {
        if (!empty($conn)) {
            mysqli_close($conn);
            $conn = null;
        }
        return;
    }
    // Setup a database connection if no database connection is available yet.
    if (empty($conn)) {
        $PHORUM = $GLOBALS['PHORUM'];
        $conn = mysqli_connect($PHORUM['DBCONFIG']['server'], $PHORUM['DBCONFIG']['user'], $PHORUM['DBCONFIG']['password'], $PHORUM['DBCONFIG']['name'], $PHORUM['DBCONFIG']['port'], $PHORUM['DBCONFIG']['socket']);
        if ($conn === FALSE) {
            if ($flags & DB_NOCONNECTOK) {
                return FALSE;
            }
            phorum_database_error('Failed to connect to the database.');
            exit;
        }
        if (!empty($PHORUM['DBCONFIG']['charset'])) {
            mysqli_query($conn, "SET NAMES '{$PHORUM['DBCONFIG']['charset']}'");
        }
        // putting this here for testing mainly
        // All of Phorum should work in strict mode
        if (!empty($PHORUM["DBCONFIG"]["strict_mode"])) {
            mysqli_query($conn, "SET SESSION sql_mode='STRICT_ALL_TABLES'");
        }
    }
    // Return a quoted parameter.
    if ($return === DB_RETURN_QUOTED) {
        return mysqli_real_escape_string($conn, $sql);
    }
    // RETURN: database connection handle
    if ($return === DB_RETURN_CONN) {
        return $conn;
    }
    // By now, we really need a SQL query.
    if ($sql === NULL) {
        trigger_error('Internal error: phorum_db_interact(): ' . 'missing sql query statement!', E_USER_ERROR);
    }
    // Execute the SQL query.
    // For queries where we are going to retrieve multiple rows, we
    // use an unuffered query result.
    if ($return === DB_RETURN_ASSOCS || $return === DB_RETURN_ROWS) {
        $res = FALSE;
        if (mysqli_real_query($conn, $sql) !== FALSE) {
            $res = mysqli_use_result($conn);
        }
    } else {
        $res = mysqli_query($conn, $sql);
//.........这里部分代码省略.........
开发者ID:sheldon,项目名称:dejavu,代码行数:101,代码来源:mysqli.php


示例14: db_write

/**
 * @param $sql
 * @param $paras
 * @return bool|string
 */
function db_write($sql, $paras)
{
    if (dbconfig_w::Provider == "mysqli") {
        //mysqli的情况
        if (extension_loaded("mysqli")) {
            $con = mysqli_connect(dbconfig_w::DataSource, dbconfig_w::UserID, dbconfig_w::Password, dbconfig_w::InitialCatalog, dbconfig_w::Port);
            if ($con != false) {
                if ($paras == null) {
                    $rel = mysqli_real_query($con, $sql);
                    $data = false;
                    if ($rel != false) {
                        $data = $rel;
                    } else {
                        $data = dberror::SQL_EXCEPTION;
                    }
                } else {
                    $mt = $con->stmt_init();
                    $mt->prepare($sql);
                    foreach ($paras as $para) {
                        $val = $para->value;
                        mysqli_stmt_bind_param($mt, $para->type, $val);
                    }
                    unset($para);
                    $rel = mysqli_stmt_execute($mt);
                    if ($rel != false) {
                        $data = $rel;
                    } else {
                        return dberror::SQL_EXCEPTION;
                    }
                }
                mysqli_close($con);
                return $data;
            } else {
                return dberror::CONNECT_EXCEPTION;
            }
        } else {
            return dberror::NO_MYSQLI_EXCEPTION;
        }
    } else {
        //mysql的情况
        if (extension_loaded("mysql")) {
            $con = mysql_connect(dbconfig_w::DataSource, dbconfig_w::UserID, dbconfig_w::Password, dbconfig_w::InitialCatalog, dbconfig_w::Port);
            if ($con != false) {
                if ($paras == null) {
                    $rel = mysql_query($con, $sql);
                    $data = false;
                    if ($rel != false) {
                        $data = true;
                    } else {
                        $data = dberror::SQL_EXCEPTION;
                    }
                } else {
                    $data = dberror::MYSQL_NO_PREPARE_EXCEPTION;
                }
                mysql_close($con);
                return $data;
            } else {
                return dberror::CONNECT_EXCEPTION;
            }
        } else {
            return dberror::NO_MYSQL_EXCEPTION;
        }
    }
}
开发者ID:Takeya-Yuki-Studio,项目名称:Yuki-Auth-Login,代码行数:69,代码来源:dbconnect.php


示例15: excel

	margin-bottom: 3em;
}
.left {
	
}
.right {
	width: 60%;
}
</style>
<h1>Non-Auditioning Ents</h1>
<p> Download in <a href="nonAudition_Spreadsheet.php">spreadsheet format</a>. This is a tab separated file. In order to import it into excel (or similar software) correctly, make sure the 'tab' box is the only box checked for the delimiters (comma, space, etc should be unchecked).</p>
<table>
<?php 
$cv = mysqli_connect("localhost", "mayball_admin", "XuthebAw97");
mysqli_select_db($cv, "mayball");
mysqli_real_query($cv, "SELECT * FROM ents WHERE ents_slot_id=0;");
if ($result = mysqli_use_result($cv)) {
    while (($row = mysqli_fetch_assoc($result)) != null) {
        echo "<tr>";
        echo "<td class='right'>";
        echo "<span class='label'>Act Name</span>: " . $row["act_name"] . "<br />";
        echo "<span class='label'>Act Type</span>: " . $row["act_type"] . "<br />";
        echo "<span class='label'>Genre/Description</span>: <div id='genre'>" . nl2br($row["genre"]) . "</div><br />";
        echo "<span class='label'>Website</span>: <div id='genre'>" . nl2br($row["website"]) . "</div><br />";
        echo "<span class='label'>Performance Location</span>: <div id='genre'>" . nl2br($row["performance_location"]) . "</div><br />";
        echo "<span class='label'>Contact</span>: <a href='mailto:'" . $row["contact_email"] . "'>" . $row["contact_name"] . "</a> [" . $row["contact_phone"] . "] <br />";
        echo "</td>";
        echo "</tr>";
    }
}
mysqli_free_result($result);
开发者ID:JJMinton,项目名称:2014JesusMayBall_frontpage,代码行数:31,代码来源:viewNonAudition.php


示例16: mysqli_store_result

mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA);
if (mysqli_get_server_version($link) > 50000) {
    // let's try to play with stored procedures
    mysqli_real_query($link, 'DROP PROCEDURE IF EXISTS p');
    if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) READS SQL DATA BEGIN SELECT id FROM test WHERE id >= 100 ORDER BY id; SELECT id + 1, label FROM test WHERE id > 0 AND id < 3 ORDER BY id; SELECT VERSION() INTO ver_param;
END;')) {
        mysqli_multi_query($link, "CALL p(@version)");
        do {
            if ($res = $link->store_result(MYSQLI_STORE_RESULT_COPY_DATA)) {
                printf("---\n");
                var_dump($res->fetch_all());
                $res->free();
            } else {
                if ($link->errno) {
                    echo "Store failed: (" . $link->errno . ") " . $link->error;
                }
            }
        } while ($link->more_results() && $link->next_result());
        mysqli_real_query($link, 'SELECT @version AS p_version');
        $res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA);
        $tmp = mysqli_fetch_assoc($res);
        if (!is_array($tmp) || empty($tmp) || !isset($tmp['p_version']) || '' == $tmp['p_version']) {
            printf("[024] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link));
            var_dump($tmp);
        }
        mysqli_free_result($res);
    } else {
        printf("[025] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
    }
}
print "done!";
开发者ID:gleamingthecube,项目名称:php,代码行数:31,代码来源:ext_mysqli_tests_mysqli_store_result_copy.php


示例17: mysqli_change_user

mysqli_change_user($link, "0123456789-10-456789-20-456789-30-456789-40-456789-50-456789-60-456789-70-456789-80-456789-90-456789", "password", $db);
mysqli_kill($link, -1);
// mysqli_ping() cannot be tested, because one would need to cause an error inside the C function to test it
mysqli_real_query($link, "FOO");
if (@mysqli_select_db($link, "Oh lord, let this be an unknown database name")) {
    printf("[009] select_db should have failed\n");
}
// mysqli_store_result() and mysqli_use_result() cannot be tested, because one would need to cause an error inside the C function to test it
// Check that none of the above would have caused any error messages if MYSQL_REPORT_ERROR would
// not have been set. If that would be the case, the test would be broken.
mysqli_report(MYSQLI_REPORT_OFF);
mysqli_multi_query($link, "BAR; FOO;");
mysqli_query($link, "FOO");
mysqli_change_user($link, "This might work if you accept anonymous users in your setup", "password", $db);
mysqli_kill($link, -1);
mysqli_real_query($link, "FOO");
mysqli_select_db($link, "Oh lord, let this be an unknown database name");
mysqli_report(MYSQLI_REPORT_OFF);
mysqli_report(MYSQLI_REPORT_STRICT);
try {
    if ($link = my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket)) {
        printf("[010] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", $host, $user . 'unknown_really', $db, $port, $socket);
    }
    mysqli_close($link);
} catch (mysqli_sql_exception $e) {
    printf("[011] %s\n", $e->getMessage());
}
try {
    if (!($link = mysqli_init())) {
        printf("[012] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
    }
开发者ID:zaky-92,项目名称:php-1,代码行数:31,代码来源:ext_mysqli_tests_mysqli_report_wo_ps.php


示例18: printf

<?php

require_once 'connect.inc';
if (!($link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))) {
    printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket);
}
if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p')) {
    printf("[003] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
}
if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25), OUT ver_out VARCHAR(25)) BEGIN SELECT ver_in INTO ver_out; END;')) {
    if (!($stmt = mysqli_prepare($link, 'CALL p(?, ?)'))) {
        printf("[005] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
    }
    $ver_in = 'myversion';
    $ver_out = '';
    if (!mysqli_stmt_bind_param($stmt, 'ss', $ver_in, $ver_out)) {
        printf("[006] Cannot bind parameter, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
    }
    if (!mysqli_stmt_execute($stmt)) {
        printf("[007] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
    }
    printf("[008] More results: %s\n", mysqli_more_results($link) ? "yes" : "no");
    printf("[009] Next results: %s\n", mysqli_next_result($link) ? "yes" : "no");
    if (!mysqli_stmt_bind_result($stmt, $ver_out) || !mysqli_stmt_fetch($stmt)) {
        printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
    }
    if ("myversion" !== $ver_out) {
        printf("[011] Results seem wrong got '%s'\n", $ver_out);
    }
    if (!mysqli_stmt_close($stmt)) {
        printf("[012] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
开发者ID:gleamingthecube,项目名称:php,代码行数:31,代码来源:ext_mysqli_tests_mysqli_stmt_execute_stored_proc_out.php


示例19: mysqli_real_query

        mysqli_real_query($link, 'SELECT @version AS p_version');
        $res = mysqli_store_result($link);
        $tmp = mysqli_fetch_assoc($res);
        if (!is_array($tmp) || empty($tmp) || !isset($tmp['p_version']) || '' == $tmp['p_version']) {
            printf("[008a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link));
            var_dump($tmp);
        }
        mysqli_free_result($res);
    } else {
        printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
    }
    mysqli_real_query($link, 'DROP FUNCTION IF EXISTS f');
    if (mysqli_real_query($link, 'CREATE FUNCTION f( ver_param VARCHAR(25)) RETURNS VARCHAR(25) DETERMINISTIC RETURN
ver_param;')) {
        mysqli_real_query($link, 'SELECT f(VERSION()) AS f_version');
        $res = mysqli_store_result($link);
        $tmp = mysqli_fetch_assoc($res);
        if (!is_array($tmp) || empty($tmp) || !isset($tmp['f_version']) || '' == $tmp['f_version']) {
            printf("[009a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link));
            var_dump($tmp);
        }
        mysqli_free_result($res);
    } else {
        printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
    }
}
mysqli_close($link);
if (NULL !== ($tmp = mysqli_real_query($link, "SELECT id FROM test"))) {
    printf("[011] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
}
print "done!";
开发者ID:gleamingthecube,项目名称:php,代码行数:31,代码来源:ext_mysqli_tests_mysqli_real_query.php


示例20: executeUpdate

 function executeUpdate($stmt)
 {
     $result = @mysqli_real_query($this->link, $stmt);
     if ($result == FALSE) {
         trigger_error("Invalid query: " . mysqli_error($this->link), E_USER_ERROR);
     }
     $this->num_queries++;
     return FALSE;
 }
开发者ID:BackupTheBerlios,项目名称:k4bb-svn,代码行数:9,代码来源:mysqli.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP mysqli_report函数代码示例发布时间:2022-05-15
下一篇:
PHP mysqli_real_escape_string函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap