conversion to database

They have: 45 posts

Joined: Oct 2001

I have a website, and I'm considering making it based on MySQL, since it would fit perfectly (because it's a collection of articles and things). It would make updating a lot easier, and that's a really good thing.. However, the problem is that I have many many files, and doing it by hand. So the problem is is there an easy way to convert the files? Because the sections of the files are marked off very clearly (there's the title, the main body, etc). So theoretically it's possible. So any ideas?

Peter J. Boettcher's picture

They have: 812 posts

Joined: Feb 2000

When you say the sections are clearly marked off, how? For you to be able to import this data into a database every field/section will have to be separated by a common delimiter (like a comma or something).

PJ | Are we there yet?
pjboettcher.com

They have: 45 posts

Joined: Oct 2001

well basically, the main fields i need are marked off in the html files: for example, the title is in between the and tags, the body text is in between a set of comments ( somthin like ) and the author is set off in a similar fashion. Obviously, w/ a find/replace, i can change them to commas. Is it possible then to easily mass-import them into a database without too much work?

Peter J. Boettcher's picture

They have: 812 posts

Joined: Feb 2000

It would probably be simpler to create a script that reads the html files and then writes to a database. So the script would search for three distinct sections (title,body, and author) and write the content to the title, body, and author fields in the database.

It's not to hard but I doubt there's any automatic programs that will do this for you.

PJ | Are we there yet?
pjboettcher.com

They have: 45 posts

Joined: Oct 2001

oh, thanks! Do you know what language would be best to write such a script? B/c unfortunately i'm not particularly good at programming. Any help would be much appreciated.

Peter J. Boettcher's picture

They have: 812 posts

Joined: Feb 2000

If you're not that comfortable with programming then you should probably use VB or VBScript since it's syntax is very english like, but still has the power to do what you need.

PJ | Are we there yet?
pjboettcher.com

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.