Current location - Loan Platform Complete Network - Big data management - How does php import excel? How does php import a database?
How does php import excel? How does php import a database?

How to use PHP to import table data into excel. Below is a function I wrote to export data from PHP to CSV to ask for a price. Just make a call then. /***Export CSV file

*@paramstring$fileName file name

*@paramstringarray$data export data, string value array in csv format

*@paramstring$to_encoding target conversion encoding

*@paramstring$from_encoding current encoding

*/

Function exportCSV($fileName=, $data=, $ to_encoding=){

$fileName=empty($fileName)? Date(YmdHis

Title(charset=$from_encoding

Title(filename=$fileName.csv

$str=;

if ($data){

if(is_array($data)){

foreach($dataas$v){

if(is_array($v) ){

foreach($vas$vo){

$str. =(is_numeric($vo)?"".$vo:$vo."").",

}

$str=trim($str,

}else {

$str.=(is_numeric($v) ? "".$v:$v)",

}

}

$str=trim,

}Otherwise{

$str=$data

}

}

echomb_convert_encoding($str,);

Exit;

}

How to import excel data into mysql database?

1. Use PHPExcelParserPro software, but this software is paid software;

2. You can save the EXCEL table in CSV format, and then import it through phpmyadmin or SQLyog. The SQLyog import method is: · Save the EXCEL table as CSV format; · Open SQLyog, and right-click the table to be imported. Click, click "Import" - "Import using Load local CSV data"; · In the pop-up dialog box, click "Change...", select "Fill in excel-friendly values", and click OK; · In "Import from file" Select the CSV file path to be imported and click "Import" to import the data into the table;

3. A relatively stupid manual method is to first use excel to generate sql statements, and then go to mysql Run, this method is suitable for importing excel tables into various sql databases: Suppose your table has three columns of data A, B, and C. You want to import the table tablename into your database. The corresponding fields are col1, col2, col3·Add a column to your table and use excel formulas to automatically generate SQL statements. The specific method is as follows: 1) Add a column (assuming it is column D) 2) Enter the formula in column D of the first row, which is D1: = CONCATENATE("insertintotablename(col1,col2,col3)values(",A1,",",B1,",",C1,");")3) At this time, D1 has generated the following sql statement: insertintotable(col1 ,col2,col3)values('a','11','33');4) Copy the formula of D1 to column D of all rows (just click and hold the lower right corner of cell D1 with the mouse and drag it down) ) 5) At this time, all sql statements have been generated in column D. 6) Copy column D to a plain text file, assuming it is sql.txt. Just put sql.txt into the database and run it. You can use the command line Import, you can also run it with phpadmin.

How to insert data from the database into excel in php?

It is recommended that you first generate the csv file format, and then manually convert it into an excel file. PHP does have extensions to support generating excel, such as PHPExcel. However, it is relatively troublesome.

Use asp, php or html reads excel data and displays it on the current web page?

Use the excel file as the data source, such as through the oledb connection method. When reading, a worksheet is equivalent to a table data table, and it can be read in a loop

Help: How to use A Java program to import Excel data?

First you need to understand the steps to import files:

1. Instantiate the excel reading object

2. Load the excel file

All Load

Select to load

3. Read excel file

Read all

Read line by line

See below which one is more suitable for you

By the way, I will list a few other languages ????to import Excel files, I hope it will be helpful to you

PHP imports Excel files

java imports Excel file data into the database

PHP implements a general method of exporting Excel files

JXL generated excel file + JAVA file download function

Java general Excel file Generate tool class, support generated files and direct browser download

Java handles Excel files---creation, deletion, writing, reading of excel files

Java reads Excel files

jxl parses Excel files

JXL operates Excel files

javaPOI reads Excel files

java uses poi to read excel files code example

Use jxl to generate Excel files

PHP verification code file class

PHP download remote files

PHP get the size of remote files

p>

php compressed CSS files

PHP forced file download

php read csv file class

php simple ftp file upload example

A PHP class to generate zip files

How to export data from mysql database into excel format? Is it PHP?

Yes>Right-click-"Task-"Export data--"An export page will appear. Do not change the data source or database name. Just look at the authentication method -> Select the authentication method for logging into the database this time - Select the database you want to export from the database below and go to the next step. A new page appears. The first line is the target. Here, select the target type you want to export. If you want to export to excel format, select the excel format (scroll up). Below is the target address you want to save to. You do not need to select the version. , I believe everyone is on version 07 or above. ————》{Next step}————》Go directly to the next step——————”Select the table to be exported and go directly to the next step. It’s all about the next step. ,. The same goes for importing. Please note that the first page data source when importing is the format you want to import. If it is the excel format you just exported, select the excel format. Others can be ignored.