Two PHP export excel examples_PHP tutorial
Two php tutorials to export excel examples
When exporting excel, if a certain column exports an ID number, you will find after opening the excel file that the ID number automatically uses scientific notation. No matter how you modify the column attributes, you will not be able to achieve your requirements. Some people on the Internet said that after changing the column attribute to text, there will be no problem when inputting it. This is indeed the case in Excel, but it cannot be done when exporting from the PHP programheader("content-type:application/vnd.ms-excel; charset=gbk");
header("content-disposition:attachment;filename=test_data.xls");
$link=mysql tutorial_connect('localhost','root','hhhkkk');
if($link){mysql_select_db('dataui',$link);
Mysql_query("set names 'gbk'");
echo "Database tutorial connection has been successful!";
}else{
echo "Database connection failed!";
}echo "project name"."t";
echo "Project details"."t";
$sql="select * from php168_item_content where fid='11'";
$query=mysql_query($sql);
while($rs=mysql_fetch_array($query)){
echo $rs[title]."t";
$sql2="select * from php168_item_content_1 where id='$rs[id]'";
$query2=mysql_query($sql2);
While($rs2=mysql_fetch_array($query2)){
echo $rs2[content]."t";
echo "n";
}
}
?>
//Experimental data, in actual operations, the data should be obtained from the database
$emps tutorial[0]['id'] = '00001';
$emps[0]['name'] = 'abc';
$emps[0]['sexual'] = 'male';
$emps[0]['age'] = 28;
$emps[1]['id'] = '00002';$emps[1]['name'] = 'bbc';
$emps[2]['id'] = '00003';
$emps[1]['sexual'] = 'male';
$emps[1]['age'] = 23;
$emps[2]['name'] = 'cba';
$smarty->assign('emps', $emps);
$emps[2]['sexual'] = 'female';
$emps[2]['age'] = 20;
ini_set('include_path', '/data/website/htdocs/includes');
require_once('smarty.php');
$smarty = new smarty();
// Output the file header, indicating that the excel file is to be output
header("content-type: application/vnd.ms-excel");
header("content-disposition: attachment; filename=test.xls");
$smarty->display('excel-xml.tpl');
?>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

In this chapter, we will understand the Environment Variables, General Configuration, Database Configuration and Email Configuration in CakePHP.

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

To work on file upload we are going to use the form helper. Here, is an example for file upload.

In this chapter, we are going to learn the following topics related to routing ?

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

Validator can be created by adding the following two lines in the controller.
