Loading...

php使用PDO獲取結果的方法

Temperature: 0 °C

Mark ChangMark Chang
author_tools

fetch()

式例如下:
mixed PDOStatement::fetch([int fetch_style][,int cursor_orientation[,int cursor_offset]]])

fetchAll()

式例如下:
array PDOStatement::fetchAll([int fetch_style[,int column_index]])

fetch_style控制結果的返回方式,類別如下:
PDO::FETCH_ASSOC — 關聯陣列形式
PDO::FETCH_NUM — 數字索引陣列形式
PDO::FETCH_BOTH — 兩者陣列形式都有,這是預設的
PDO::FETCH_OBJ — 按照物件的形式,類似於以前的 mysql_fetch_object()
PDO::FETCH_BOUND–以布林值的形式返回結果,同時獲取的列值賦給bindParam()方法中的指定變數。
PDO::FETCH_LAZY–以關聯陣列、數字索引陣列和物件3種形式返回結果

以上紀錄。

https://innstory.com/story-php使用PDO獲取結果的方法-2328
PHP

Prev
 設置屬性_PHP_PDO_setAttribute

Next
Linux下查詢已安裝的PHP版本 

About the Author

Mark Chang

離不開電腦的宅男

Visitor message

Leave some footprints to prove that you visited me

Recommended reading

Author's other related stories

要如何修改Plesk空間上傳檔案大小的限制

要如何修改Plesk空間上傳...

Plesk的預設狀況下上傳檔案限制為M。 若要修改上傳限制 首先點選開發工具的PHP設定 innim...

當域名 DNS 尚未生效時,如何預先設定及測試網站

當域名 DNS 尚未生效時,...

建置一個新的網站或是將網站搬家時 常常會遇到一個問題,就是要將網址指向到新的網站空間,設定完畢但需要...

設置屬性 PHP PDO setAttribute

設置屬性 PHP PDO s...

PDO::ATTRCASE:強制列名為指定的大小寫。 PDO::CASELOWER:強制列名小寫。 ...

Please select an option

error

Hi, thank you for your participation, but you cannot vote repeatedly~

Join innstory now and start recording your story.

"Innstory" is a place to store stories. We are committed to becoming a warm platform. Deepening the bonds between people is our direction.
We are convinced that the blockchain between people is not just a cold calculation. Join us now.

Wrong format