Quantcast
Channel: 可丁丹尼 @ 一路往前走2.0
Viewing all articles
Browse latest Browse all 79

Call to undefined method mysqli_stmt::get_result()

$
0
0

Call to undefined method mysqli_stmt::get_result()

前言

讀此篇文章時必需要俱備PHP的開發基礎,其文章主要會以快速記錄開發心得所提供的程式內容技巧,有不能理解之處請下留言處留言。

問題

在測試PHP mysqli提供的statement方式時發生:

"PHP message: PHP Fatal error: Call to undefined method mysqli_stmt::get_result()"

技巧

PHP目前提供MySQL操作方式使用原生的驅動方式,也就是使用C寫成擴展的方式提供,所以必要安裝此擴展才能有完整的功能,此擴展的名稱為mysqlnd,先檢查此套件功能是否有發揮:

執行:

$ php -i|grep -i mysqlnd

結果:

/etc/php5/cli/conf.d/10-mysqlnd.ini,
Client API version => mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $
Client API library version => mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $
mysqlnd
mysqlnd => enabled
Version => mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $
Loaded plugins => mysqlnd,debug_trace,auth_plugin_mysql_native_password,auth_plugin_mysql_clear_password,auth_plugin_sha256_password
mysqlnd statistics =>
Client API version => mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $
$

或是直接查詢套件有無安裝:

$ apt list|grep mysqlnd
php5-mysqlnd/oldstable,now 5.6.33+dfsg-0+deb8u1 amd64 [installed]

有安裝會有[installed]提示,如果未看到請立刻按裝mysqlnd,以Debian/Ubuntu為例:

apt install php5-mysqlnd

參考資料

[RESOLVED] call to undefined method mysqli_stmt::get_result()

The post Call to undefined method mysqli_stmt::get_result() appeared first on 可丁丹尼 @ 一路往前走2.0.


Viewing all articles
Browse latest Browse all 79

Trending Articles