<?php
class db
{
public static function connect($host,$user,$pass){
//action
}
public function __construct($tb,$pk){
}
public $_tbname = '';
public $_pkname = '';
public function save(){//insert / update
}
public function clear(){//clear field
}
public function row($pk){ //select * from tb where pkname=$pk // return 1 record (array)
}
public function rows($query,$limit=0,$page=1){ //for pagination query rows // return several record (array)(array)
}
public function totalRow(){//data build after pagination
}
public function totalPage(){//data build after pagination
}
}
db::connect('','','');
$d = new db('tbnews','id');
$d->clear();
$d->col1 = $_GET['col1'];
$d->col2 = $_GET['col2'];
$d->col3 = $_GET['col2'];
$d->save(); //insert
$d->clear();
$d->id = $_GET['id'];
$d->col1 = $_GET['col1'];
$d->col2 = $_GET['col2'];
$d->col3 = $_GET['col2'];
$d->save(); //update because set pk
$rows = db->rows('select * from tb where id>100', 10, 1); //rows of page 1 (10 rows per page)
$rows = db->rows('select * from tb where id>100', 10, 2); //rows of page 2
echo $db->totalPage();
?>