Jump to content

Importing excel into a MySQL database


sanfly

Recommended Posts

Hi Guys

 

i have an excel file I want to read into a database.  I found a tutorial which says to save the file into a xml file, then it basically gets all the data out, and puts it into an array

 

The code seems to be falling over at this line so far: 

 

if ( $_FILES['file']['tmp_name'] ){

  $dom = DOMDocument::load( $_FILES['file']['tmp_name'] );

  $rows = $dom->getElementsByTagName( 'Row' );

 

.....

 

and gives this error:

Undefined class name 'domdocument' in /home/myhost/public_html/import.php 

 

Ive also tried this

 

if ( $_FILES['file']['tmp_name'] ){

  $dom = new DOMDocument();

$dom->load($_FILES['file']['tmp_name']);

$rows = $dom->getElementsByTagName( 'Row' );

 

.....

 

which gives this error:

 

Cannot instantiate non-existent class: domdocument in /home/myhost/public_html/import.php

 

Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/53337-importing-excel-into-a-mysql-database/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.