PDO 的遊標為什麼無效

來源:互聯網
上載者:User
PDO 的遊標為何無效?
本帖最後由 baidu_26094577 於 2015-02-27 14:53:25 編輯

$aa = $db->prepare('select * from user',array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL));
$aa ->execute();
$aa->fetch();
$aa->fetch();
$a=$aa->fetch(PDO::FETCH_NUM, PDO::FETCH_ORI_NEXT);
print_r($a);


prepare中已經設定了開啟遊標;
結果是第三行,而不是最後一行;
測試了所有的fetch第二個參數,均無效;

求問這是什麼原因,這個又不是復原,需要表是INNODB嗎?
按照手冊上的寫法,也不好用,很是費解;
求助中....thinks;
------解決思路----------------------
當然是第三行記錄啦,你仔細看看手冊上的例子以及函數的說明
------解決思路----------------------
FETCH_ORI_NEXT
Fetch the next row in the result set. Valid only for scrollable cursors.
取下一行的結果集

FETCH_ORI_PRIOR
Fetch the previous row in the result set. Valid only for scrollable cursors.
取前一行的結果集

FETCH_ORI_FIRST (integer)
Fetch the first row in the result set. Valid only for scrollable cursors.
取結果集中的第一行

FETCH_ORI_LAST
Fetch the last row in the result set. Valid only for scrollable cursors.
取最後一行的結果集

FETCH_ORI_ABS
Fetch the requested row by row number from the result set. Valid only for scrollable cursors.
擷取所請求的行數從結果集

FETCH_ORI_REL
Fetch the requested row by relative position from the current position of the cursor in the result set. Valid only for scrollable cursors.
擷取所請求的行從結果中游標當前位置的相對位置的設定
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.