php こりずに、、、
ここのところなんに使うこともないだろうphpをただ使っている。
DBのレコード位置指定でしゅとくする物を、、、、つくってみようとする。
require_once ("ini.php");
require_once ("log.inc");
require_once ("dbmethods.inc");class DBPager {
var $onePageLength = "20";
var $pages = "0";
var $allPage = "0";
var $curPage = "1";var $pdo;
var $tblname;
var $fields;
var $where;
var $orderby;public function DBPager ( $pdo, $tblname, $fields, $where, $orderby ) {
$this->pdo = $pdo;
$this->tblname = $tblname;
$this->fields = $fields;
$this->where = $where;
$this->orderby = $orderby;
$this->allPage = CDBMethods::selectCount( $this->pdo, $this->tblname, $this->fields, $this->where );$this->setCurPage( $this->curPage );
}
public function getData() {
return CDBMethods::selectOffset(
$this->pdo, $this->tblname, $this->fields, $this->where, $this->orderby
, bcmul( bcsub( $this->curPage, "1" ), $this->onePageLength)
, $this->onePageLength
);
}public function getOnePageLength() {
return $this->onePageLength;
}public function setOnePageLength( $onePageLength ) {
$this->onePageLength = $onePageLength;
}public function getPages() {
return $this->pages;
}public function getCurPage() {
return $this->curPage;
}public function setCurPage( $curPage ) {
$this->curPage = $curPage;
$this->calcPage();
}public function getAllPage() {
return $this->allPage;
}private function calcPage() {
$this->pages = bcdiv( bcsub( $this->allPage, bcmod ( $this->allPage, $this->onePageLength ))
, $this->onePageLength );if ( bccomp( bcmod ( $this->allPage, $this->onePageLength ) , "0" ) == 1 ) {
$this->pages = bcadd( $this->pages, "1" );
}}
}
ただかいてるだけで、ロクニ動かさず、、、(いまだに?)
ここのブログに張りつけた何日か前のソースは、跡形もなく違ったものに??
これ見て変だなと思ってる人は当たってると思う?
またこれもぜんぜん中身が変わるでしょう?
しかし、xampplite1.7.0のMYSQLにはやられた、、、
pdoから2カラムselectするとCLIどうたらこうたらとWindowsの異常終了メッセージが出てうまくいかない??
2・3日ぐらい1カラムしかとれなかった。1.6.8にしたらなんとなく調子がいい。
何もかもとは言わないけど、(そんなに使ってないし)。
http://www.apachefriends.org/download.php?xampplite-win32-1.7.0.zip
の1.7.0を1.6.8にしたらダウンロードが出来た。。。。よくわからないけど。