您好,登錄后才能下訂單哦!
下文內(nèi)容主要給大家?guī)?a title="mysql" target="_blank" href="http://www.kemok4.com/mysql/">mysqli_stmt_execute 的相關(guān)定義和用法,所講到的知識,與書籍略有不同,都是億速云專業(yè)技術(shù)人員在與用戶接觸過程中,總結(jié)出來的,具有一定的經(jīng)驗(yàn)分享價(jià)值,希望給廣大讀者帶來幫助。
mysqli_stmt_execute - 執(zhí)行準(zhǔn)備好的查詢
PHP4 | PHP5 | PHP7 |
---|---|---|
不支持 | 支持 | 支持 |
mysqli_stmt_execute ( mysqli_stmt $stmt )
執(zhí)行以前使用 mysqli_prepare() 函數(shù)準(zhǔn)備的查詢。 執(zhí)行后,任何存在的參數(shù)標(biāo)記將自動(dòng)替換為適當(dāng)?shù)臄?shù)據(jù)。 如果該語句是UPDATE,DELETE或INSERT,則可以使用 mysqli_stmt_affected_rows() 函數(shù)確定受影響的行總數(shù)。 同樣,如果查詢產(chǎn)生結(jié)果集,則使用 mysqli_stmt_fetch() 函數(shù)。
注意: 使用mysqli_stmt_execute()時(shí),必須在執(zhí)行任何其他查詢之前使用mysqli_stmt_fetch()函數(shù)來獲取數(shù)據(jù)。
參數(shù) | 必需的 | 描述 |
---|---|---|
stmt | 是 | 由 mysqli_stmt_init() 返回的 statement 標(biāo)識。 |
成功時(shí)返回 TRUE, 或者在失敗時(shí)返回 FALSE。
<?php /* Open a connection */ $link = mysqli_connect("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } mysqli_query($link, "CREATE TABLE myCountry LIKE Country"); mysqli_query($link, "INSERT INTO myCountry SELECT * FROM Country"); $query = "SELECT Name, Code FROM myCountry ORDER BY Name"; if ($stmt = mysqli_prepare($link, $query)) { /* drop table */ mysqli_query($link, "DROP TABLE myCountry"); /* execute query */ mysqli_stmt_execute($stmt); printf("Error: %s.\n", mysqli_stmt_execute($stmt)); /* close statement */ mysqli_stmt_close($stmt); } /* close connection */ mysqli_close($link);
mysqli_prepare() - 準(zhǔn)備執(zhí)行一個(gè)SQL語句
mysqli_stmt_bind_param() - 將變量綁定到準(zhǔn)備好的語句作為參數(shù)
mysqli_stmt_get_result() - 從準(zhǔn)備好的語句獲取結(jié)果集
對于以上關(guān)于mysqli_stmt_execute 的相關(guān)定義和用法,如果大家還有更多需要了解的可以持續(xù)關(guān)注我們億速云的行業(yè)推新,如需獲取專業(yè)解答,可在官網(wǎng)聯(lián)系售前售后的,希望該文章可給大家?guī)硪欢ǖ闹R更新。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。