well in my case, i needed to get the HTML source so that i could edit the data later.
// get contents of news html file into a string
$filename = "/home/username/www/news.html";
$handle = fopen($filename, "r");
$news_html = fread($handle, filesize($filename));
fclose ($handle);
// Prepare $news_html variable for mysql enty
$news_html = addslashes($news_html);
then you just build a query string and enter the $news_html into the Mysql database.
After the Data is entered into the database, you now have the HTML source data, ready to edit!
After You edit the data and save it back to the Mysql database you have to Pull it back out and Save it to the Actual HTML File
// Pull news_html from mysql database
$result = mysql_query("SELECT content FROM news WHERE keyId = 1");
// if there is data in the mysql database, Pull it out!
if($row = mysql_fetch_array($result))
{
$news_html = $row["content"];
// write changes to file
$filename = '/home/username/www/news.html';
$handle = fopen($filename, 'w');
fwrite($handle, $news_html);
fclose($handle);
}
else
{
echo "No data was pulled from the database! Cannot write file!";
}
Now You Just Wrote all the data from the database to the "news.html" file.
MAKE SURE YOU CHANGE THE PERMISSIONS OF THE 'news.html' TO 777
Or else you won't be able to write to the file!!
Hope that was helpful!
[EDIT]
for more information, check out php.net. lookup the fopen, fread, fwrite, and fclose functions [/EDIT]