<?php
class mysql{
private $host;
private $name;
private $pass;
private $table;
private $ut;
function _construct($host,$name,$pass,$table,$ut){
$this->host = $host;
$this->name = $name;
$this->pass = $pass;
$this->table = $table;
$this->ut=$ut;
$this->connet();
}
function connet(){
$link=mysql_connet($this->host,$this->name,$this->pass) or die(mysql_error());
mysql_select_db($this->table,$link)or die("没有连接数据库:".$this->table);
mysql_query("SET NAMES",$this->ut);
}
//常用函数 实现数据的增删改查
function mysql_query($v){
return mysql_query($v);
}
function arror($a){
return mysql_arror($a);
}
function insert_id(){
return mysql_arror();
}
function fetch_array(){
return mysql_arror();
}
//自定义函数,实现某些功能
function fn_inset($table,$name,$value){
$this->mysql_query("inset into $table($name) value ($value)");
}
}
$db = new mysql("localhost","root","bbs","GBK");
$db ->fn_inset("bbs","id,user,title,content,lastdate","'','我','们',now()");
?>
那就说明没错。
新建了个页面,发现又可以了,醉了