問題描述
我在mysqli_stmt_execute
之后不知道什么時(shí)候調(diào)用什么,遇到了問題你怎么知道什么時(shí)候打電話
I'm running into problems knowing when and what to call after mysqli_stmt_execute
How do you know when to call
- mysqli_stmt_bind_result
- mysqli_stmt_store_result
- mysqli_stmt_fetch
推薦答案
mysqli_stmt_bind_result()
告訴 mysqli 當(dāng)你獲取一行時(shí)你想填充哪個(gè)變量,但它沒有 fetch()
任何東西.在調(diào)用 fetch 之前,必須調(diào)用一次.
mysqli_stmt_bind_result()
tells mysqli which variable you want to be populate when you fetch a row, but it doesn't fetch()
anything yet. This is necessary to call once, before you call fetch.
mysqli_stmt_store_result()
設(shè)置一個(gè)可選行為,以便客戶端在您 fetch()
第一行時(shí)下載所有行,并將整個(gè)結(jié)果集緩存在客戶端(即 PHP).隨后的 fetch()
調(diào)用將簡(jiǎn)單地迭代這個(gè)客戶端緩存的結(jié)果集.但是設(shè)置這個(gè)選項(xiàng)本身也不會(huì)導(dǎo)致 fetch() .此功能完全可選.
mysqli_stmt_store_result()
sets an optional behavior so that the client downloads all rows when you fetch()
the first row, and caches the whole result set in the client (i.e. PHP). Subsequent fetch()
calls will simply iterate over this client-cached result set. But setting this option itself does not cause a fetch() yet either. This function is totally optional.
mysqli_stmt_fetch()
返回結(jié)果集中的下一行,并將其存儲(chǔ)在綁定變量中.您必須在循環(huán)中為結(jié)果集的每一行調(diào)用此函數(shù).也就是說,直到 fetch 返回 false.
mysqli_stmt_fetch()
returns the next row in the result set, and causes it to be stored in a bound variable. You must call this function in a loop, for each row of the result set. That is, until the fetch returns false.
這篇關(guān)于mysqli 函數(shù) bind_result、store_result 和 fetch 之間有什么區(qū)別?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!