Home Backend Development PHP Tutorial Import and export EXCEL files to the database on the WEB page_PHP tutorial

Import and export EXCEL files to the database on the WEB page_PHP tutorial

Jul 13, 2016 pm 05:26 PM
excel web exist import Export Work database document system need page

Due to work needs, the author needs to import the contents of the EXCEL file into the database in the OA system, and at the same time, export the contents of the database to the EXCEL file. The author's OA was developed in PHP and applied on WEB pages, so it is difficult to process it directly in PHP. After research, the author developed an ACTIVEX control using DELPHI to process the data of EXCEL files, then submitted the data to the server and then saved it to the database, easily realizing the import of EXCEL file data. The export does not use the ACTIVEX control and is processed directly with PHP. The method is to directly generate the data into a CSV file. Because CSV is a comma-delimited text file and can be opened and processed directly with EXCEL, it can meet the requirements. The implementation method will be introduced below. Imported page code: "Personnel Number", "FIELDNAME"=>"STUFFID", "FIELDTYPE"=>"A"), array ("CAPTION"=>"Start Date", "FIELDNAME"=>"BEGINDATE", "FIELDTYPE"=>"A"), array ("CAPTION"=>"EndDate", "FIELDNAME"=>"ENDDATE", "FIELDTYPE"=>"A"), array ("CAPTION"=>"Contract Content", "FIELDNAME"=>"CONTRACTTEXT", "FIELDTYPE"=>"A"), array ("CAPTION"=>"Remarks", "FIELDNAME"=>"THISMEMO", "FIELDTYPE"=>"A" ), array ("CAPTION"=>"Server file name", "FIELDNAME"=>"DOCFILE", "FIELDTYPE"=>"A"), array ("CAPTION"=>"File type", "FIELDNAME"= >"FILETYPE", "FIELDTYPE"=>"A"), array ("CAPTION"=>"Local file name", "FIELDNAME"=>"FILENAME", "FIELDTYPE"=>"A"), array (" CAPTION"=>"File extension", "FIELDNAME"=>"EXTNAME", "FIELDTYPE"=>"A")); //Construct SQL statement, field name part $strSQL = "INSERT INTO HR_WORKCONTRACT ("; $ strTemp = ""; for ($i = 0; $i ExecSQL ($strSQL.$strTmp)) $do->SetObject ("ERR", "Data import failed!"); else $do->SetObject ("ERR ", "Data imported successfully! "); //echo $strSQL.$strTmp; $strTmp = ""; } } } if (trim ($strTmp) != "") { $strTmp = substr ($strTmp, 0 , strlen ($strTmp) - 2).";"; if (!$do->ExecSQL ($strSQL.$strTmp)) $do->SetObject ("ERR", "Data import failed! "); else $do->SetObject ("ERR", "Data import successful!");//echo $strSQL.$strTmp; } }?>The page for importing labor contract information and importing data is as follows: The imported EXCEL file can be displayed All content, and you can manually select the data to be imported, and you can temporarily modify the data (the modified data is displayed in red to show the difference). You can select EXCEL files on the local hard disk, including XLS. Both file and CSV formats

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/531993.htmlTechArticleDue to work needs, the author needs to import the contents of the EXCEL file into the database in the OA system, and also needs Export the contents of the database to an EXCEL file. The author's OA uses P...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1664
14
PHP Tutorial
1266
29
C# Tutorial
1239
24
Huawei's Qiankun ADS3.0 intelligent driving system will be launched in August and will be launched on Xiangjie S9 for the first time Huawei's Qiankun ADS3.0 intelligent driving system will be launched in August and will be launched on Xiangjie S9 for the first time Jul 30, 2024 pm 02:17 PM

On July 29, at the roll-off ceremony of AITO Wenjie's 400,000th new car, Yu Chengdong, Huawei's Managing Director, Chairman of Terminal BG, and Chairman of Smart Car Solutions BU, attended and delivered a speech and announced that Wenjie series models will be launched this year In August, Huawei Qiankun ADS 3.0 version was launched, and it is planned to successively push upgrades from August to September. The Xiangjie S9, which will be released on August 6, will debut Huawei’s ADS3.0 intelligent driving system. With the assistance of lidar, Huawei Qiankun ADS3.0 version will greatly improve its intelligent driving capabilities, have end-to-end integrated capabilities, and adopt a new end-to-end architecture of GOD (general obstacle identification)/PDP (predictive decision-making and control) , providing the NCA function of smart driving from parking space to parking space, and upgrading CAS3.0

Always new! Huawei Mate60 series upgrades to HarmonyOS 4.2: AI cloud enhancement, Xiaoyi Dialect is so easy to use Always new! Huawei Mate60 series upgrades to HarmonyOS 4.2: AI cloud enhancement, Xiaoyi Dialect is so easy to use Jun 02, 2024 pm 02:58 PM

On April 11, Huawei officially announced the HarmonyOS 4.2 100-machine upgrade plan for the first time. This time, more than 180 devices will participate in the upgrade, covering mobile phones, tablets, watches, headphones, smart screens and other devices. In the past month, with the steady progress of the HarmonyOS4.2 100-machine upgrade plan, many popular models including Huawei Pocket2, Huawei MateX5 series, nova12 series, Huawei Pura series, etc. have also started to upgrade and adapt, which means that there will be More Huawei model users can enjoy the common and often new experience brought by HarmonyOS. Judging from user feedback, the experience of Huawei Mate60 series models has improved in all aspects after upgrading HarmonyOS4.2. Especially Huawei M

iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos Jul 18, 2024 am 05:48 AM

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

Detailed tutorial on establishing a database connection using MySQLi in PHP Detailed tutorial on establishing a database connection using MySQLi in PHP Jun 04, 2024 pm 01:42 PM

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())

How to handle database connection errors in PHP How to handle database connection errors in PHP Jun 05, 2024 pm 02:16 PM

To handle database connection errors in PHP, you can use the following steps: Use mysqli_connect_errno() to obtain the error code. Use mysqli_connect_error() to get the error message. By capturing and logging these error messages, database connection issues can be easily identified and resolved, ensuring the smooth running of your application.

Huawei will launch the Xuanji sensing system in the field of smart wearables, which can assess the user's emotional state based on heart rate Huawei will launch the Xuanji sensing system in the field of smart wearables, which can assess the user's emotional state based on heart rate Aug 29, 2024 pm 03:30 PM

Recently, Huawei announced that it will launch a new smart wearable product equipped with Xuanji sensing system in September, which is expected to be Huawei's latest smart watch. This new product will integrate advanced emotional health monitoring functions. The Xuanji Perception System provides users with a comprehensive health assessment with its six characteristics - accuracy, comprehensiveness, speed, flexibility, openness and scalability. The system uses a super-sensing module and optimizes the multi-channel optical path architecture technology, which greatly improves the monitoring accuracy of basic indicators such as heart rate, blood oxygen and respiration rate. In addition, the Xuanji Sensing System has also expanded the research on emotional states based on heart rate data. It is not limited to physiological indicators, but can also evaluate the user's emotional state and stress level. It supports the monitoring of more than 60 sports health indicators, covering cardiovascular, respiratory, neurological, endocrine,

Tsinghua Optics AI appears in Nature! Physical neural network, backpropagation is no longer needed Tsinghua Optics AI appears in Nature! Physical neural network, backpropagation is no longer needed Aug 10, 2024 pm 10:15 PM

Using light to train neural networks, Tsinghua University results were recently published in Nature! What should I do if I cannot apply the backpropagation algorithm? They proposed a Fully Forward Mode (FFM) training method that directly performs the training process in the physical optical system, overcoming the limitations of traditional digital computer simulations. To put it simply, it used to be necessary to model the physical system in detail and then simulate these models on a computer to train the network. The FFM method eliminates the modeling process and allows the system to directly use experimental data for learning and optimization. This also means that training no longer needs to check each layer from back to front (backpropagation), but can directly update the parameters of the network from front to back. To use an analogy, like a puzzle, backpropagation

How to use database callback functions in Golang? How to use database callback functions in Golang? Jun 03, 2024 pm 02:20 PM

Using the database callback function in Golang can achieve: executing custom code after the specified database operation is completed. Add custom behavior through separate functions without writing additional code. Callback functions are available for insert, update, delete, and query operations. You must use the sql.Exec, sql.QueryRow, or sql.Query function to use the callback function.

See all articles