刷新页面的时候出现这个:Say:
insert into te (id,title,tdate) vlaue ('','我插入的信息',now())代码片段:
$db = new mysql('localhost','root','','test',"GBK"); $db->fn_insert('te','id,title,date',"'','我插入的信息',now()");在数据库test建立te表
CREATE TABLE `te` (
`id` tinyint(1) NOT NULL auto_increment,
`title` varchar(50) NOT NULL,
`date` date NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=gbk AUTO_INCREMENT=1 ;
insert into te (id,title,tdate) vlaue ('','我插入的信息',now())代码片段:
$db = new mysql('localhost','root','','test',"GBK"); $db->fn_insert('te','id,title,date',"'','我插入的信息',now()");在数据库test建立te表
CREATE TABLE `te` (
`id` tinyint(1) NOT NULL auto_increment,
`title` varchar(50) NOT NULL,
`date` date NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=gbk AUTO_INCREMENT=1 ;
页面上是这样显示的啊
Say:
insert into te (id,title,date) vlaue ('','我插入的信息',now())
function fn_insert($table,$name,$value){ $this->query("insert into $table ($name) vlaue ($value)"); }
function query($sql, $type = '') {
if(!($query = mysql_query($sql))) $this->show('Say:', $sql);
return $query;
}
我在前面已经设置mysql_query的方法了啊 而且把value改成values也出现错误 插入不了数据,不会是数据库的本省问题吧!