易截截图软件、单文件、免安装、纯绿色、仅160KB

php分页

<?php
//分页
$link=mysql_connect("localhost","root","root");
$db=mysql_select_db("bustest",$link);
$res=mysql_query("select * from info");
//一共多少条
$count=mysql_num_rows($res);
//每页5条信息
$perpage=5;
//一共多少页
$pagecount=ceil($count/$perpage);
//传过来的页数
$pagenum=$_REQUEST['page'];
//判断$pagenum是否有值
if(!isset($pagenum)){
 $pagenum=1;
}elseif($pagenum>$pagecount){
$pagenum=$pagecount;
}elseif($pagenum<=0){
$pagenum=1;
}
//查询
$sql="select * from info limit ".($pagenum-1)*$perpage.",".$perpage;
$resc=mysql_query($sql);
print("<table border='1'>");
print("<tr><th>ID</th><th>NAME</th></tr>");
while($row=mysql_fetch_array($resc)){
 print("<tr><td>");
 print $row["id"];
 print("</td><td>");
 print $row["name"];
 print("</td></tr>");
 }
 print("</table>");
 mysql_free_result($resc);
mysql_free_result($res);
mysql_close($link);
print("<a href=".$_SERVER["PHP_SELF"]."?page=".($pagenum+1).">下一页</a>");
print("<a href=".$_SERVER["PHP_SELF"]."?page=".($pagenum-1).">上一页</a>");
?>


相关文档:

php 关于如何获取域名或者IP地址的$_SERVER['']

服务器变量 $_SERVER 详解:
1、$_SESSION['PHP_SELF'] -- 获取当前正在执行脚本的文件名
2、$_SERVER['SERVER_PROTOCOL'] -- 请求页面时通信协议的名称和版本。例如,“HTTP/1.0”。
3、$_SERVER['REQUEST_TIME'] -- 请求开始时的时间戳。从 PHP 5.1.0 起有效。和time函数效果一样。
4、$_SERVER['argv'] - ......

php对zip文件解压和压缩

<?php
/**
* @author wyt
*
*/
class zip {
private $_zipObj=null;
private $_zipfcArr=array();
private $_basePath=null;
private $_zipName;
/**
* init
* @param zip文件名称 $zipName
*/
function __construct($zipName){
$this->_zipName=$zipName;
$this->_zipObj= ......

Linux下C++实现PHP扩展中级应用(一)


此篇文章准备分2个部分来讲述:
    第一部分主要详细讲述一下怎么构建一个完成的C++应用扩展模块;
   
第二部分主要讲述在PHP及Zend框架下怎么使用Zend API和C++语言来实现自己所要的功能以及项目的开发;
    此篇文章所运用的环境在Linux
2.4.21-4.ELsmp(Red Ha ......

php删除文件和整个文件夹

function delfile($dir)
{
if (is_dir($dir))
{
$dh=opendir($dir);
while (false !== ( $file = readdir ($dh)))
{
if($file!="." && $file!="..")
{
$fullpath=$dir."/".$file;
if(!is_dir($fullpath))
{
unlink($fullpath);
} ......

php动态生成表格的合并

<?php
$link=mysql_connect("localhost","root","root");
$db=mysql_select_db("bustest",$link);
$sql1="select name from info group by name order by id asc";
print("<table border='1'>");
$res1=mysql_query($sql1);
while($row1=mysql_fetch_array($res1)){
$name=$row1["name"];
$sql2="select i ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号