473,408 Members | 2,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Import data from HTML to MySQL

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.

Oct 29 '07 #1
6 5875
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.
Oct 29 '07 #2
You haven't provided enough information to answer the question.
Well, that's fair..

here it is the html code (it repeats):

[...]
<TABLE WIDTH=100%><TD CLASS=pt>Maincourses<TR><TD><HR></
TABLE><TABLE><TR><TD WIDTH=30><TD WIDTH=30><TD WIDTH=30><TD
WIDTH=30><TD WIDTH=30>
<TR><TD><TD><TD><B>Pasta</B<TD><B>Format</B<TD CLASS=cr><B>XXXX</
B<TD CLASS=cr><B>YYYYYYY</B>
<TR><TD><TD><TD>Name1 <TD>Name1a <TD CLASS=cr>Q.ta1 <TD
CLASS=cr>Q.ta1b
<TR><TD><TD><TD>Name2 <TD>Name2b <TD CLASS=cr>Q.ta2 <TD
CLASS=cr>Q.ta2b
[...]
</TABLE><BR><BR>

<TABLE WIDTH=100%><TD CLASS=pt>Dessert<TR><TD><HR></
TABLE><TABLE><TR><TD WIDTH=30><TD WIDTH=30><TD WIDTH=30><TD
WIDTH=30><TD WIDTH=30>
<TR><TD><TD><TD><B>Cake</B<TD><B>Type</B<TD CLASS=cc><B>XXXX</B>
<TD CLASS=cc><B>YYYYYYY</B>
<TR><TD><TD><TD>Name1 <TD>Name1a <TD CLASS=cc>Q.ta1 <TD
CLASS=cc>Q.ta1b
<TR><TD><TD><TD>Name2 <TD>Name2b <TD CLASS=cc>Q.ta2 <TD
CLASS=cc>Q.ta2b
[...]
</TABLE><BR><BR>

Thank you.

Oct 29 '07 #3
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

Oct 30 '07 #4
mfoolb wrote:
>You haven't provided enough information to answer the question.

Well, that's fair..

here it is the html code (it repeats):

[...]
<TABLE WIDTH=100%><TD CLASS=pt>Maincourses<TR><TD><HR></
TABLE><TABLE><TR><TD WIDTH=30><TD WIDTH=30><TD WIDTH=30><TD
WIDTH=30><TD WIDTH=30>
<TR><TD><TD><TD><B>Pasta</B<TD><B>Format</B<TD CLASS=cr><B>XXXX</
B<TD CLASS=cr><B>YYYYYYY</B>
<TR><TD><TD><TD>Name1 <TD>Name1a <TD CLASS=cr>Q.ta1 <TD
CLASS=cr>Q.ta1b
<TR><TD><TD><TD>Name2 <TD>Name2b <TD CLASS=cr>Q.ta2 <TD
CLASS=cr>Q.ta2b
[...]
</TABLE><BR><BR>

<TABLE WIDTH=100%><TD CLASS=pt>Dessert<TR><TD><HR></
TABLE><TABLE><TR><TD WIDTH=30><TD WIDTH=30><TD WIDTH=30><TD
WIDTH=30><TD WIDTH=30>
<TR><TD><TD><TD><B>Cake</B<TD><B>Type</B<TD CLASS=cc><B>XXXX</B>
<TD CLASS=cc><B>YYYYYYY</B>
<TR><TD><TD><TD>Name1 <TD>Name1a <TD CLASS=cc>Q.ta1 <TD
CLASS=cc>Q.ta1b
<TR><TD><TD><TD>Name2 <TD>Name2b <TD CLASS=cc>Q.ta2 <TD
CLASS=cc>Q.ta2b
[...]
</TABLE><BR><BR>

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.
Oct 30 '07 #5
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.
js*******@attglobal.net
==================

Oct 30 '07 #6
"mfoolb" <ma***@neomedia.itwrote in message
news:11**********************@22g2000hsm.googlegro ups.com...
>
You haven't provided enough information to answer the question.

Well, that's fair..

here it is the html code (it repeats):

[...]
<TABLE WIDTH=100%><TD CLASS=pt>Maincourses<TR><TD><HR></
TABLE><TABLE><TR><TD WIDTH=30><TD WIDTH=30><TD WIDTH=30><TD
WIDTH=30><TD WIDTH=30>
<TR><TD><TD><TD><B>Pasta</B<TD><B>Format</B<TD CLASS=cr><B>XXXX</
B<TD CLASS=cr><B>YYYYYYY</B>
<TR><TD><TD><TD>Name1 <TD>Name1a <TD CLASS=cr>Q.ta1 <TD
CLASS=cr>Q.ta1b
<TR><TD><TD><TD>Name2 <TD>Name2b <TD CLASS=cr>Q.ta2 <TD
CLASS=cr>Q.ta2b
[...]
</TABLE><BR><BR>

<TABLE WIDTH=100%><TD CLASS=pt>Dessert<TR><TD><HR></
TABLE><TABLE><TR><TD WIDTH=30><TD WIDTH=30><TD WIDTH=30><TD
WIDTH=30><TD WIDTH=30>
<TR><TD><TD><TD><B>Cake</B<TD><B>Type</B<TD CLASS=cc><B>XXXX</B>
<TD CLASS=cc><B>YYYYYYY</B>
<TR><TD><TD><TD>Name1 <TD>Name1a <TD CLASS=cc>Q.ta1 <TD
CLASS=cc>Q.ta1b
<TR><TD><TD><TD>Name2 <TD>Name2b <TD CLASS=cc>Q.ta2 <TD
CLASS=cc>Q.ta2b
[...]
</TABLE><BR><BR>
Reformatting the above into one tag per line (see below)
quicky reveals that the tables are improperly formatted.

The first <TDis not within a <TR>;
no closing </TDor </TRtags;
inconsistent number of columns in a row; et.al.

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

[...]
<TABLE WIDTH=100%>
<TD CLASS=pt>Maincourses
<TR>
<TD>
<HR>
</TABLE>

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

<BR>
<BR>

<TABLE WIDTH=100%>
<TD CLASS=pt>Dessert
<TR>
<TD>
<HR>
</TABLE>
<TABLE>
<TR>
<TD WIDTH=30>
<TD WIDTH=30>
<TD WIDTH=30>
<TD WIDTH=30>
<TD WIDTH=30>
<TR>
<TD>
<TD>
<TD>
<B>Cake</B>
<TD><B>Type</B>
<TD CLASS=cc><B>XXXX</B>
<TD CLASS=cc><B>YYYYYYY</B>
<TR>
<TD>
<TD>
<TD>Name1
<TD>Name1a
<TD CLASS=cc>Q.ta1
<TD CLASS=cc>Q.ta1b
<TR>
<TD>
<TD>
<TD>Name2
<TD>Name2b
<TD CLASS=cc>Q.ta2
<TD CLASS=cc>Q.ta2b
[...]
</TABLE>

<BR>
<BR>
Oct 30 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Michel Feldheim | last post by:
Hi everybody, I have some big csv-like files with 15.000 and more artikles stored in it. They should be put into a mysql database. I thought about PHP processing but only the read and print...
2
by: Damien | last post by:
Hi to all, I need to design an import/export system. Data comes from a filemaker pro DB in a big CSV file. Some alterations are made on the data as it is imported into my mysql table. Data is...
0
by: adrian GREEMAN | last post by:
When I try to import a text file with new data for an existing table I get the error "1148 - the used command is not allowed with this MySQL version." I have tried with both PHPMyAdmin2.3 and...
2
by: Brian Huether | last post by:
I saved my website databgase to my home computer. I am setting up a local version of the site, and need to import the database. I have mysql and everything set up. But when I try to run the sql...
4
by: news | last post by:
Our production database in an exported textfil runs about 60 MB. Compressed that's about 9 MB. I'm trying to import the export into another machine running FC3 and mySQL 11.18, and it appears as...
2
by: Andy Fish | last post by:
Hi, I have a single-file aspx file (no codebehind). when I try to do this: <%@ Import Namespace="MySql.Data.MySqlClient" %> I get this: CS0246: The type or namespace name 'MySql' could...
7
by: phillip.s.powell | last post by:
We're looking at a GUI interface for our MySQL DB and I am interested in MySQL Administrator, however, one of our requirements is to be able to import/export databases. Is this possible or do I...
0
by: NewbieSupreme | last post by:
I'm using PHPMyAdmin on an Apache2Triad install (latest version; 5.x.x, which installs PHP5 and PHPMyAdmin 2.8 as well). In Access, I exported a table to a text file, tab-delimited, text qualifyer...
7
by: Randy | last post by:
Folks: We have a web-based app that's _really_ slowing down because multiple clients are writing their own private data into a single, central database. I guess the previous programmer did...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.