欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

php調(diào)用mysql存儲(chǔ)過(guò)程

 更新時(shí)間:2007年02月14日 00:00:00   作者:  
前面轉(zhuǎn)載了一篇《php調(diào)用mysql存儲(chǔ)過(guò)程的文章》經(jīng)過(guò)測(cè)試,發(fā)現(xiàn)文章中的方法似乎不可行!

調(diào)用帶有select語(yǔ)句的存儲(chǔ)過(guò)程就出現(xiàn) PROCEDURE p can't return a result set in the given context的錯(cuò)誤。google了半天,在mysql官網(wǎng)上找到一些說(shuō)法,db_mysql的模塊不支持存儲(chǔ)過(guò)程調(diào)用,解決方法是用db_mysqli。測(cè)試了一下,果然可以了。

用法比較簡(jiǎn)單,沒(méi)啥好說(shuō)的,從網(wǎng)上copy一段代碼吧:


<?php
/* Connect to a MySQL server */
$link = mysqli_connect(
'localhost', /* The host to connect to */
'root', /* The user to connect as */
'root', /* The password to use */
'db_name'); /* The default database to query */
if (!$link) {
printf("Can't connect to MySQL Server. Errorcode: %s\n", mysqli_connect_error());
exit;
}
/* Send a query to the server */
if ($result = mysqli_query($link, "call se_proc('crm')")) {
/* Fetch the results of the query */
while( $row = mysqli_fetch_array($result) ){
echo ($row[0]. "--------- SR. " . $row[1] . "
");
}
/* Destroy the result set and free the memory used for it */
mysqli_free_result($result);
}
/* Close the connection */
mysqli_close($link);
?>

郁悶的是費(fèi)了半天勁搞出來(lái)的存儲(chǔ)過(guò)程效率居然不如以前- -

相關(guān)文章

最新評(píng)論