Hi,
Thanks in advance for any help provided.
I have set up a database where one of the fields has names of text files.
I can call up these names easily. and i can also read the text files and print them on the web page easily. here is the code:
// Connection Information
$dbhost = "localhost";
$dbuser = "******";
$dbpass = "******";
$dbname = "news";
// Connect to MySql
$connect = mysql_connect($dbhost, $dbuser, $dbpass)
or die("Unable to connect to MySql");
// Connect to Database
$db = mysql_select_db($dbname, $connect)
or die("Unable to connect to Database");
//Run Query
$sql = "SELECT full_article FROM october WHERE article_id='21_10_01_001'";
$result = mysql_query($sql)
or die ("Unable to complete the Query");
//While loop to place data in an array
while($row = mysql_fetch_array($result)) {
$full_art = $row["full_article"];
}
//Print out the data field
echo "$full_art <br>";
//print out article
$text = fopen("./october/$full_art", "r");
fpassthru ($text);
It works well but the problem is that the text file(s) are actually broken up into a number of paragraphs. But using the above code the text in the file appears with no paragraph breaks. Just one long paragraph. My question is, is there anyway to print out the text exactly as it appears in the txt file?
any help is greatly appreciated.
thank you
Mike
Thanks in advance for any help provided.
I have set up a database where one of the fields has names of text files.
I can call up these names easily. and i can also read the text files and print them on the web page easily. here is the code:
// Connection Information
$dbhost = "localhost";
$dbuser = "******";
$dbpass = "******";
$dbname = "news";
// Connect to MySql
$connect = mysql_connect($dbhost, $dbuser, $dbpass)
or die("Unable to connect to MySql");
// Connect to Database
$db = mysql_select_db($dbname, $connect)
or die("Unable to connect to Database");
//Run Query
$sql = "SELECT full_article FROM october WHERE article_id='21_10_01_001'";
$result = mysql_query($sql)
or die ("Unable to complete the Query");
//While loop to place data in an array
while($row = mysql_fetch_array($result)) {
$full_art = $row["full_article"];
}
//Print out the data field
echo "$full_art <br>";
//print out article
$text = fopen("./october/$full_art", "r");
fpassthru ($text);
It works well but the problem is that the text file(s) are actually broken up into a number of paragraphs. But using the above code the text in the file appears with no paragraph breaks. Just one long paragraph. My question is, is there anyway to print out the text exactly as it appears in the txt file?
any help is greatly appreciated.
thank you
Mike