We had published article about Pear library. Why we are using pear library because in export option they gave simple and flexible with ease of code implementation. In also their documentation clear to understand. Here we gave sample of how to Export XLS file using Pear with PDO and to export the users information as excel file with PDO OOPs . Once you do with our sample code and if you are got idea you can customize code as your wish.
First of all, You can create tmp dirertory in your localhost. Because excel tmp cache files are stored in that location.
CREATE TABLE IF NOT EXISTS `users` (
`user_id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`status` tinyint(2) NOT NULL DEFAULT '0' COMMENT '1-active,0-deactive',
PRIMARY KEY (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
Click here link to download code.