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

PHP不变的一些经典类

 MYSQL,分页类是写PHP代码最常用的几个类。
今天看PHP100的视频,越用越发现里面两个类好强大,虽然感觉还是有局限性,但是它的写法已经很成熟了。
一个是MYSQL,一个是分页类。
MYSQL:
<?php
class mysql {
private $db_host; //数据库主机
private $db_user; //数据库用户名
private $db_pwd; //数据库用户名密码
private $db_database; //数据库名
private $conn; //数据库连接标识;
private $result; //执行query命令的结果资源标识
private $sql; //sql执行语句
private $row; //返回的条目数
private $coding; //数据库编码,GBK,UTF8,gb2312
private $bulletin = true; //是否开启错误记录
private $show_error = true; //测试阶段,显示所有错误,具有安全隐患,默认关闭
private $is_error = false; //发现错误是否立即终止,默认true,建议不启用,因为当有问题时用户什么也看不到是很苦恼的
/*构造函数*/
public function __construct($db_host, $db_user, $db_pwd, $db_database, $conn, $coding) {
$this->db_host = $db_host;
$this->db_user = $db_user;
$this->db_pwd = $db_pwd;
$this->db_database = $db_database;
$this->conn = $conn;
$this->coding = $coding;
$this->connect();
}
/*数据库连接*/
public function connect() {
if ($this->conn == "pconn") {
//永久链接
$this->conn = mysql_pconnect($this->db_host, $this->db_user, $this->db_pwd);
} else {
//即使链接
$this->conn = mysql_connect($this->db_host, $this->db_user, $this->db_pwd);
}
if (!mysql_select_db($this->db_database, $this->conn)) {
if ($this->show_error) {
$this->show_error("数据库不可用:", $this->db_database);
}
}
mysql_query("SET NAMES $this->coding");
}
/*数据库执行语句,可执行查询添加修改删除等任何sql语句*/
public function query($sql) {
if ($sql == "") {
$this->show_error("SQL语句错误:", "SQL查询语句为空");
}
$this->sql = $sql;
$result = mysql_query($this->sql, $this->conn);
if (!$result) {
//调试中使用,sql语句出错时会自动打印出来
if ($this->show_


相关文档:

PHP 5.2.11安装

#找到:
    # If the AddEncoding directives above are commented-out, then you
    # probably should define those extensions to indicate media types:
    #
    AddType application/x-compress .Z
    AddType application/x-gz ......

fedora12下安装apache+php+mysql(LAMP)+phpmyadmin

1 安装MySQL5
用下列命令安装MySQL:
yum install mysql mysql-server
然后我们为MySQL创建系统启动链接(这样的话,MySQL就会随着系统启动而启动),并启动MySQL服务器:
chkconfig –levels 235 mysqld on
/etc/init.d/mysqld start
运行
mysqladmin -u root password yourrootsqlpassword
来为root用户设置 ......

PHP 发送邮件

 
PHP 发送邮件
作者:w3pop.com 翻译/整理:w3pop.com 发布:2007-04-28 修改:2007-06-17 浏览:14208 ::  :: 
 PHP Sessions
PHP allows you to send e-mails directly from a script.
PHP允许你通过脚本直接发送e-mail。
The PHP mail() Function
PHP mail()函数
The PHP m ......

PHP实例:用SESSION方法实现验证码

index.php(实现输入验证码页面)代码如下: Code代码如下: <html>
<head>
<title>check code</title>
</head>
<body>
<form name=check method=post action=check.php>
<input type=hidden name=init value=1>
验证 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号