惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
SecWiki News
SecWiki News
酷 壳 – CoolShell
酷 壳 – CoolShell
爱范儿
爱范儿
量子位
M
MIT News - Artificial intelligence
GbyAI
GbyAI
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
TaoSecurity Blog
TaoSecurity Blog
博客园 - 【当耐特】
H
Heimdal Security Blog
腾讯CDC
The Last Watchdog
The Last Watchdog
Security Archives - TechRepublic
Security Archives - TechRepublic
Hacker News: Ask HN
Hacker News: Ask HN
S
Schneier on Security
Microsoft Security Blog
Microsoft Security Blog
WordPress大学
WordPress大学
博客园 - 司徒正美
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
Cybersecurity and Infrastructure Security Agency CISA
S
SegmentFault 最新的问题
大猫的无限游戏
大猫的无限游戏
Application and Cybersecurity Blog
Application and Cybersecurity Blog
F
Full Disclosure
有赞技术团队
有赞技术团队
T
Tailwind CSS Blog
Engineering at Meta
Engineering at Meta
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Threatpost
月光博客
月光博客
A
Arctic Wolf
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
雷峰网
雷峰网
T
Troy Hunt's Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The Cloudflare Blog
D
DataBreaches.Net
O
OpenAI News
L
LINUX DO - 最新话题
宝玉的分享
宝玉的分享
小众软件
小众软件
V
Vulnerabilities – Threatpost
A
About on SuperTechFans
人人都是产品经理
人人都是产品经理
T
The Exploit Database - CXSecurity.com
Martin Fowler
Martin Fowler
美团技术团队
P
Privacy International News Feed

博客园 - ShineWayCN

System Rebuild Linux commands Linux 知识点滴 我的常规系统安装 SSI@IIS 将 ASPX 页面编译成 DLL web.config 文档框架 网址收集 .NET中的中文简繁体转换 @OutputCache指令参数 如何提高.NET循环的效率 .NET中的MD5加密 Global.asax 文档框架 标准代码页列表 VBScript 函数 @Page指令参数 ASP.NET中调用自定义DLL C# 编译器命令行实例 ASCII 字符集
分页组件 PHP5+MSSQL
ShineWayCN · 2005-07-17 · via 博客园 - ShineWayCN
<?
class pagerecordset
{

	private $cn;
	private $rs;
	private $totalpage = 0;
	private $totalrecord = 0;
	private $bpos = 1;
	private $epos = 1;
	private $row = null;
	private $firstpage = 1;
	private $prevpage = 1;
	private $nextpage = 1;
	private $lastpage = 1;
	public $pageindex = 1;
	public $pagerecordcount = 10;

	public function __construct()
	{
		$ip = func_get_arg(0);
		$uid = func_get_arg(1);
		$pwd = func_get_arg(2);
		$this->cn = mssql_connect($ip , $uid , $pwd) or die("Connection creation fail!");
	}

	function __destruct()
	{
	}

	public function fetch($sql)
	{
		$this->rs = mssql_query($sql) or die("Query execution fail!");
		$this->totalrecord = mssql_num_rows($this->rs);
		if ($this->totalrecord == 0)
		{
		}
		else
		{
			$this->totalpage = ceil($this->totalrecord / $this->pagerecordcount);
			$this->firstpage = 1;
			$this->lastpage = $this->totalpage;
			$this->prevpage = $this->pageindex - 1;
			$this->nextpage = $this->pageindex + 1;
			if ($this->prevpage < 1)
			{
				$this->prevpage = $this->lastpage;
			}
			if ($this->nextpage > $this->lastpage)
			{
				$this->nextpage = $this->firstpage;
			}
			$this->bpos = ($this->pageindex - 1) * $this->pagerecordcount;
			$this->epos = $this->bpos + $this->pagerecordcount;
			if ($this->epos > $this->totalrecord)
			{
				$this->epos = $this->totalrecord - $this->bpos + $this->bpos;
			}
		}
		mssql_data_seek($this->rs , $this->bpos) or die("Head locate fail!");
	}

	public function read()
	{
		$returnval = false;
		if ($this->bpos < $this->epos)
		{
			$this->row = mssql_fetch_array($this->rs);
			$this->bpos++;
			$returnval = true;
		}
		return $returnval;
	}

	public function getfield($fieldname)
	{
		$returnval = "";
		$returnval = $this->row[$fieldname];
		return $returnval;
	}

	public function getposition()
	{
		$returnval = -1;
		$returnval = $this->bpos;
		return $returnval;
	}

	private function errmsg($funcbody , $errdescription)
	{
		$returnval = "";
		$returnval += "<div style='padding:5px; background:#ffd700; color:#000; font-family:Verdana; font-size:11px;'>";
		$returnval += " <div>Fundation:<strong>" + $funcbody + "</strong></div>";
		$returnval += " <div>Description:" + $errdescription + "</div>";
		$returnval += "</div>";
		return $returnval;
	}

	public function shownavigation($pagequery , $otherquery)
	{
		$html = "";
		$html .= "<div style=\"text-align:center; padding:5px;\">";
		$html .= " <div>";
		$html .= "  <a href=\"?" . $pagequery . "=" . $this->firstpage . $otherquery . "\" style=\"font-family:Webdings; font-size:12px;\">9</a>";
		$html .= "  <a href=\"?" . $pagequery . "=" . $this->prevpage . $otherquery . "\" style=\"font-family:Webdings; font-size:12px;\">7</a>";
		$html .= "  " . $this->pageindex;
		$html .= "  /";
		$html .= "  " . $this->lastpage;
		$html .= "  <a href=\"?" . $pagequery . "=" . $this->nextpage . $otherquery . "\" style=\"font-family:Webdings; font-size:12px;\">8</a>";
		$html .= "  <a href=\"?".$pagequery."=".$this->lastpage.$otherquery."\" style=\"font-family:Webdings; font-size:12px;\">:</a>";
		$html .= " </div>";
		$html .= "</div>";
		echo($html);
	}

	public function release()
	{
		mssql_free_result($this->rs) or die("Recordset destroy fail!");
		mssql_close($this->cn) or die("Connection close fail!");
	}

}
?>