PHP imports MySQL data into an Excel table.

by bookmarkscjl on 2008-08-25 15:32:44

Below is the translation of your provided Chinese text into English:

---

Sometimes when writing programs, the backend requires importing a large amount of data into the database, such as exam scores or phonebooks, which are generally stored in Excel. In this case, we can export Excel to a CSV file and then use the following program to batch-import the data into the database.

### Uploading CVS and Importing into the Database (Tested Successfully)

(Note: Some parts of the code are not standard. For example, `PHP_SELF` should be rewritten as `$_SERVER["PHP_SELF"]`.)

#### PHP Code:

```php

";

} else {

echo "";

}

?>

" METHOD="POST">

Import CVS Data

```

---

### Exporting Database to Excel Using PHP (Tested Successfully)

#### PHP Code:

```php

```

---

This is the complete translation of the provided Chinese content into English. If you need further clarification or adjustments, feel free to ask!