473,772 Members | 2,402 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5890
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>Mainco urses<TR><TD><H R></
TABLE><TABLE><T R><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>XXX X</
B<TD CLASS=cr><B>YYY YYYY</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>Desser t<TR><TD><HR></
TABLE><TABLE><T R><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>XXX X</B>
<TD CLASS=cc><B>YYY YYYY</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>Mainco urses<TR><TD><H R></
TABLE><TABLE><T R><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>XXX X</
B<TD CLASS=cr><B>YYY YYYY</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>Desser t<TR><TD><HR></
TABLE><TABLE><T R><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>XXX X</B>
<TD CLASS=cc><B>YYY YYYY</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*******@attgl obal.net
=============== ===

Oct 30 '07 #6
"mfoolb" <ma***@neomedia .itwrote in message
news:11******** **************@ 22g2000hsm.goog legroups.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>Mainco urses<TR><TD><H R></
TABLE><TABLE><T R><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>XXX X</
B<TD CLASS=cr><B>YYY YYYY</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>Desser t<TR><TD><HR></
TABLE><TABLE><T R><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>XXX X</B>
<TD CLASS=cc><B>YYY YYYY</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>Mainco urses
<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>XXX X</B>
<TD CLASS=cr><B>YYY YYYY</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>Desser t
<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>XXX X</B>
<TD CLASS=cc><B>YYY YYYY</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
23643
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 of these lines using the read_csv() function as in the attached script has a more-minutes execution time. What would be the better solution.. a Visual Basic written import tool that uses ODCB or a PHP using one?
2
12391
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 something like :id,text1html, text1raw,... . Problems : 1. Texts can contain html tags, including entities (&quot; etc), so using only the ';' as separator does not work. 2. Some line are so long that is appears php breaks them down, so I lose
0
2164
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 with MySQLFront 2.5. Both these GUI programmes have an "import from text file" command which I have used successfully several times to add entries to this table before - running just this MySQL version. I have structured the data in the text...
2
9203
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 script that I exported from my site's control panel, I get an out of memory error. What is the proper way to import this database? Do I need to increase some memory setting? -brian
4
12726
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 though the file may be too big! When I try to do it via command line: mysql -u root --host=localhost printing < ./printing.txt It eventually errors out with a "syntax error on line X" and only about
2
4064
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 not be found (are you missing a using directive or an assembly reference?)
7
33417
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 need to know else (e.g. Navicat)? Thanks Phil
0
3479
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 of "none" (this is how I read to do it from newsgroups). When I use the Query window in phpmyadmin to import the text file, it waits a while, then returns an error: #1064 - You have an error in your SQL syntax; check the manual that...
7
4196
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 things this way because it made things easy. Well, I'm the person that has to put up with the long-term headache. Anywho, someone at work wants things sped up, so what I'm looking at doing is this for each client:
0
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10261
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10103
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9911
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7460
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6713
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.