首页 > include

PHP导入和导出CSV文件实现程序

我们先准备mysql数据表,假设项目中有一张记录学生信息的表student,并有id,name,sex,age分别记录学生的姓名、性别、年龄等信息。

CREATE TABLE `student` ( 
  `id` int(11) NOT NULL auto_increment, 
  `name` varchar(50) NOT NULL, 
  `sex` varchar(10) NOT NULL, 
  `age` smallint(3) NOT NULL default '0', 
  PRIMARY KEY  (`id`) 
) ENGINE=MyISAM  DEFAULT CHARSET=utf8; 

阅读全文

php与mysql留言板程序实现代码


关于PHP语法的那些就不说了,我就说一下连接mysql吧!

第一句就是描述了连接数据库的语句,并且如果失败的提示”数据库连接错误“;前面的三个参数分别代表了 数据库地址localhost,数据库用户名root,连接数据库密码mydown;

阅读全文

PHP autoload实现自动加载类

下面是使用autoload机制加载Person类的例子:

/* autoload.php */   
<?php    
function __autoload($classname) {
  require_once ($classname . “class.php”);
}    
$person = new Person(”Altair”, 6);
var_dump ($person);
?>    

阅读全文