使用方法:
<?php
require "gridtable.css";
require "mydb_class.php";
$DB = new mydb();
$RS = new myrs();
$DB->conn('localhost','root','root');
$DB->open('caigou');
$DB->query('SET NAMES UTF8');
$DB->query('SELECT * from caigou');
$RS->load($DB->rsl);
$RS->maketable('class="gridtable"','title','lis');
$DB->close();
?>
rsl = $rsl;
$this->seek(0);
$this->fld = @mysqli_num_fields($this->rsl)
or die('无法解析记录集结构。');
$this->finfo = @mysqli_fetch_fields($this->rsl)
or die('无法解析记录集结构。');
}
function seek($recno) {
@mysqli_data_seek($this->rsl,$recno)
or die('无法移动记录集指针。');
$this->fetch_row()
or die('无法获取记录集表头结构。');
}
function fetch_row() {
$this->row = @mysqli_fetch_row($this->rsl);
return $this->row;
}
function lis() {
while($this->row) {
$this->disp();
}
}
function maketable(...$cmds) {
$showcss = false;
$showtit = false;
$showlis = false;
$strcss = '';
foreach($cmds as $val) {
if($val == 'title') $showtit = true;
if($val == 'lis') $showlis = true;
if(strpos($val,'class') !== false){
$showcss = true;
$strcss = $val;
}
}
echo "
';
die(-1);
}
}
?>