Import data from HTML to MySQL

Import data from HTML to MySQL

am 29.10.2007 10:58:03 von mfoolb

Hi,

I need to import lot of data from html files (all the same layout and
tables name) to a MySQL db.
Is there any class that fullfill my needs? What's the fastest way to
accomplish that?

TIA for help.

Re: Import data from HTML to MySQL

am 29.10.2007 11:37:41 von Courtney

mfoolb wrote:
> Hi,
>
> I need to import lot of data from html files (all the same layout and
> tables name) to a MySQL db.
> Is there any class that fullfill my needs? What's the fastest way to
> accomplish that?
>
> TIA for help.
>
You haven't provided enough information to answer the question.

Re: Import data from HTML to MySQL

am 29.10.2007 12:30:50 von mfoolb

> You haven't provided enough information to answer the question.

Well, that's fair..

here it is the html code (it repeats):

[...]

Maincourses

TABLE>
WIDTH=30>
Pasta Format XXXX B> YYYYYYY
Name1 Name1a Q.ta1 CLASS=cr>Q.ta1b
Name2 Name2b Q.ta2 CLASS=cr>Q.ta2b
[...]




Dessert

TABLE>
WIDTH=30>
Cake Type XXXX
YYYYYYY
Name1 Name1a Q.ta1 CLASS=cc>Q.ta1b
Name2 Name2b Q.ta2 CLASS=cc>Q.ta2b
[...]




Thank you.

Re: Import data from HTML to MySQL

am 30.10.2007 07:53:19 von Macca

If it was standards complient html maybe you could convert it to XML
using HTML Tidy or something... would make the job easier to read and
store in MySQL.



or


Read the HTML file into a variable and do some RegEx matching or
something to extract the data

Re: Import data from HTML to MySQL

am 30.10.2007 12:03:11 von Courtney

mfoolb wrote:
>> You haven't provided enough information to answer the question.
>
> Well, that's fair..
>
> here it is the html code (it repeats):
>
> [...]
>

Maincourses

> TABLE>
> WIDTH=30>
>
Pasta Format XXXX > B> YYYYYYY
>
Name1 Name1a Q.ta1 > CLASS=cr>Q.ta1b
>
Name2 Name2b Q.ta2 > CLASS=cr>Q.ta2b
> [...]
>



>
>
Dessert

> TABLE>
> WIDTH=30>
>
Cake Type XXXX
>
YYYYYYY
>
Name1 Name1a Q.ta1 > CLASS=cc>Q.ta1b
>
Name2 Name2b Q.ta2 > CLASS=cc>Q.ta2b
> [...]
>



>
> Thank you.
>
Still not enough: where is thi code? just in a file that PHP can read ?
Once or lots of times?

I still dont understand what you are trying to do here.

Re: Import data from HTML to MySQL

am 30.10.2007 12:32:48 von Jerry Stuckle

mfoolb wrote:
> Hi,
>
> I need to import lot of data from html files (all the same layout and
> tables name) to a MySQL db.
> Is there any class that fullfill my needs? What's the fastest way to
> accomplish that?
>
> TIA for help.
>
>

There isn't going to be a class which can take your HTML and import it
into MySQL (or any other database). But check out the DOM classes - you
can probably use them to parse your html, then add the data to MySQL
yourself.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: Import data from HTML to MySQL

am 30.10.2007 14:28:54 von McKirahan

"mfoolb" wrote in message
news:1193657450.895951.305780@22g2000hsm.googlegroups.com...
>
> > You haven't provided enough information to answer the question.
>
> Well, that's fair..
>
> here it is the html code (it repeats):
>
> [...]
>

Maincourses

> TABLE>
> WIDTH=30>
>
Pasta Format XXXX > B> YYYYYYY
>
Name1 Name1a Q.ta1 > CLASS=cr>Q.ta1b
>
Name2 Name2b Q.ta2 > CLASS=cr>Q.ta2b
> [...]
>



>
> ;
no closing or tags;
inconsistent number of columns in a row; et.al.

I wouldn't count on the pages remaining in this format!

[...]
Dessert

> TABLE>
> WIDTH=30>
>
Cake Type XXXX
>
YYYYYYY
>
Name1 Name1a Q.ta1 > CLASS=cc>Q.ta1b
>
Name2 Name2b Q.ta2 > CLASS=cc>Q.ta2b
> [...]
>




Reformatting the above into one tag per line (see below)
quicky reveals that the tables are improperly formatted.

The first
is not within a


Maincourses

















Pasta
Format
XXXX
YYYYYYY


Name1
Name1a
Q.ta1
Q.ta1b


Name2
Name2b
Q.ta2
Q.ta2b
[...]









Dessert

















Cake
Type
XXXX
YYYYYYY


Name1
Name1a
Q.ta1
Q.ta1b


Name2
Name2b
Q.ta2
Q.ta2b
[...]