引
function getFields($sql,$fields){
$this->mysql_query_rst($sql);
if(mysql_errno() == 0){
if(mysql_num_rows($this->result) > 0){
$tmpfld = @mysql_fetch_row($this->result);
$this->fields = $tmpfld[$fields];
}
return $this->fields;
}else{
return '''';
}
}
//错误信息
function msg_error(){
if(mysql_errno() != 0) {
$this->msg = mysql_error();
}
return $this->msg;
}
//释放结果集
function close_rst(){
mysql_free_result($this->result);
$this->msg = '''';
$this->fieldsNum = 0;
$this->rowsNum = 0;
$this->filesArray = '''';
$this->rowsArray = '''';
$this->idsubtitle='''';
$this->idusername='''';
}
//关闭数据库
function close_conn(){
$this->close_rst();
mysql_close($this->conn);
$this->conn = '''';
}
}
?>
实例21 类的使用、密码的md5加密
复制代码 代码如下:
<?php
$conne = new opmysql();
$conne-> getRowsArray($sql);
$conne-> close_conn();
$password=”123456一二三四五六”;
echo md5($password.”www.kuphp.com”);//输出为32位的密文,是没有解密函数的,可以实现简单的加密功能。
?>