When I inserted and retrieved text to/from Mysql database the format remained same. But when I tried to insert a few lines of code and displayed them on the browser it lost the original "one below the other " format and appeared in a straight line as shown below. I am sure there must have been a smarter way to accomplish this. I have tried to locate answers on SO but couldn't find something that can address the issue mentioned here. I would like any advise/example on how to do it.
Format to be retained.
$myFile = "sampleFile.txt";
$fh = fopen($myFile, 'r');
$myFileContents = fread($fh, 21);
fclose($fh);
echo $myFileContents;
As it appears straightline on the browser.
$myFile = "sampleFile.txt"; $fh = fopen($myFile, 'r'); $myFileContents = fread($fh, 21); fclose($fh); echo $myFileContents;