| 运行代码框
 [Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
 如果您加了新功能,或者是有改进,请与大家一起分享。 测试代码如下,db.php 请到这里下载:http://www.blueidea.com/tech/program/2008/5665.asp
 <?php$db_config["hostname"]    = "127.0.0.1";    //服务器地址
 $db_config["username"]    = "root";        //数据库用户名
 $db_config["password"]    = "root";        //数据库密码
 $db_config["database"]    = "wap_blueidea_com";        //数据库名称
 $db_config["charset"]    = "utf8";
 $config["charset"]        = "utf-8";        //网站编码
 
 include('db.php');
 include('pagelist.php');
 $db    = new db();
 $db->connect($db_config);
 header("content-type:text/html;charset=".$config["charset"]);//设置页面编码
 $pl = new pagelist();
 $arr = $pl->get_rows('table_name');
 unset($pl);
 echo '<pre style="text-align:left">';
 print_r($arr);
 echo '</pre>';
 //指定特殊 sql 时候
 $pl = new pagelist();
 $sql = 'SELECT * FROM `wap_article` AS a, `wap_article_info` AS b WHERE a.id=b.articleid';
 $arr = $pl->get_rows_sql($sql);
 unset($pl);
 echo '<pre style="text-align:left">';
 print_r($arr);
 echo '</pre>';
 ?>
 当表中的记录总数在 10000条以上时,使用了 子查询分页,这样效率会更高一些,数据量小的时候,直接查询更快。这个是老王说的,参考这里:http://hi.baidu.com/thinkinginlamp/blog/item/c5dea0ecdfef5e392697910f.html
 经典论坛交流:本文链接:http://www.blueidea.com/tech/program/2008/5767.asphttp://bbs.blueidea.com/thread-2841374-1-1.html
   出处:蓝色理想
责任编辑:bluehearts
 ◎进入论坛网络编程版块参加讨论
	      |