[PHP-users 33737] Zend frameworkを使用した一部データの取得方法

View: New views
1 Messages — Rating Filter:   Alert me  

[PHP-users 33737] Zend frameworkを使用した一部データの取得方法

by 鈴木孝征 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

PHP-users MLの皆様へ。鈴木と申します。

PostgreSQL 8.1.11
PHP 5.1.6
Zend framework 1.0.3
を使用しています。

あるテーブル(A)からある条件(note ~ 'abc')に合うデータの数とその一部を取
得したいと考えています。以下スクリプトを書いたのですが、どうもZend_Db::
FETCH_ORI_ABSの設定がうまくいかないようです。

$sql = $DB->select()->from('A')->where("note ~ 'abc')->order('note');
$stm = $DB->query($sql);
print $stm->rowCount() . "\n";
for($c = $offset ; $c < $limit + $offset ; $c++){
    $row = $stm->fetch(NULL, Zend_Db::FETCH_ORI_ABS, $c);
    if(! $row) break;
    print_r($row);
}

PHPのマニュアルのPDOに関する部分によるとfetchでカーソルを有効にするには
prepareを使用し、オプションを渡さないといけないようなのですが、Zend
frameworkを使用している場合はどうしたらいいのでしょうか。

データの総数が知りたいのでSQLにlimitは使用していません。

_______________________________________________
PHP-users mailing list  PHP-users@...
http://ml.php.gr.jp/mailman/listinfo/php-users
PHP初心者のためのページ - 質問する前にはこちらをお読みください
http://oldwww.php.gr.jp/php/novice.php3
LightInTheBox - Buy quality products at wholesale price