I have a ton of articles in sql files only. How can I convert those articles in the sql files to html files? Thank you.
These huge databases of articles in sql form I purchased. Just need a way if there is a way to convert them to html. So I can grab the articles and put them where I want. Some articles I am sure I would not want on a site.
If you want to output the article to the user you could use a basic sql query ($row = mysql_fetch_array("SELECT * FROM articlestable WHERE id='the id of the article you want'") and that would output the information of that article in an array ($row). If you want to literally get the information from the database and write it to an html document you have to use the fopen and fwrite functions (get the info with a sql query and then write it to the file).
His suggestion is that you create a database and use the articles on demand by article id with a quick query. You would need one html page with php enabled. Grab the article ya need via mysql/php and echo the text in the proper place of your template. If you are trying to extract the data on your PC, you may need an editor or viewer that will strip tags and stuff that the mysql may have wrapped the text in.
If you are trying to extract the data on your PC, you may need an editor or viewer that will strip tags and stuff that the mysql may have wrapped the text in. That is what I need! The above, something to take these articles out of the sql format into html format. Loading them up to a database is not an option, as for some reason, each sql file is like 15mb and will not upload.
I never needed an editor like that, so I don't have a recomendation. As for the upload, can ya FTP the file up and then access it to load it? I assume you are using PHPMyAdmin? I think ya can access a local file as well as the upload option I'm assuming failed on ya.
to create a html file from a article in database file ,I think a small module of software can be built which will extract each article and create a html file.
If you bought it then it will be as a mysql dump. The easiest way would be to upload it to your server and get your host to run the sql dump, it'l take them seconds they should do it no problem, then extract the data you want with a mysql query like the other guy said. If you cant possibly upload it then you might need to install mysql on your local machine and run the sql dump from there. Then do the same, run queries on it until you have the articles you want. There must be some software out there to extract all the data from a mysql dump.
I do most of my programming in classic ASP so there is certainly an equivalent method in PHP but basically: 1) Write a query to grab your records from the MySQL db 2) Open a file system object (this will become your HTML file) 3) Write the recordset to a string including all the usual suspects (html, head, body, etc.) 4) Write the string you have created to the file system object 5) Save the file and close the object 6) Go to the next record and Loop 2 thru 5 until finished For file naming you can use the title from the articles replacing spaces with dashes and maybe getting smart about filename length and/or occurrances of words like "and" "or" "if" etc so you keep just keywords. Hope that makes sense. I understand why you want to do this Iowadog - I have recipe pages I do the same thing with - such that the resultant call to the page does not involve a query to the DB - speeds up the page load considerably - and if the content will be static then why not do it this way?
The easiest solution I can think of would be to write a Perl script to read the sql file(s) and extract the articles, fixing the escape characters on the fly.
iowadawg, it is much "healtyer" to keep your articles in a SQL database. in this way you will be able to modify, edit, view them much easier. i would suggest you to ask your webhosting company to help you. a couple of months ago, i had exactly the same problem i needed to import a database that was very big and phpmyadmin crashed because it did not finish loading the sql file in the set timeout. So I emailed them, they said will help me, I uploaded the SQL files to FTP, and they imported it for me.... you should try it.