TheLoveableMonty Posted February 6, 2009 Share Posted February 6, 2009 Alright, simple query. http://www.tenthousandbillboards.com/inf-bin/med/index.php As you can see under the Spain heading, there's a blank entry. The script has been programmed so that there is little to no chance of a line break slipping through so the page will display normally. That one managed to slip in though, so as a precaution I'd like to know the following. foreach ($infoSort as $infoDraft){ $infoLines = explode("#~#", $infoDraft); $title = $infoLines[0]; $link = $infoLines[1]; $location = "desc/".$infoLines[2].".dat"; if(file_exists($location)) { $description = file_get_contents($location); } if ($infoDraft != "\n") { echo " <FONT FACE=\"trebuchet ms\" COLOR=\"#FFFFFF\" SIZE=\"2\">"; echo " <BR><FONT FACE=\"trebuchet ms\" COLOR=\"#F3B809\" SIZE=\"2\"><B>$title</B></FONT> - "; echo " <A HREF=\"".$link."\">$link</A>\n"; if ($_COOKIE["u"] == $configUser && $_COOKIE["p"] == $configPass) { echo "<BR><A HREF=\"index.php?option=editEntry&filename=".$infoLines[3]."\">Edit Entry</A>"; echo " - <A HREF=\"index.php?option=deleteEntry&filename=".$infoLines[3]."\">Delete Entry</A>"; } echo " </FONT>"; } } How could I edit the above piece of code to not display blank lines from a data file? You can see my feeble attempt at attempting to not print lines from the $infoDraft variable. It doesn't work. Quote Link to comment https://forums.phpfreaks.com/topic/144024-solved-displaying-content-n-echoing-blank-information/ Share on other sites More sharing options...
TheLoveableMonty Posted February 6, 2009 Author Share Posted February 6, 2009 I got it. I trimmed and checked the $title variable as it was the first instant of the split array. I seem to have a habit of spending hours on a problem, posting here and correcting it not too long after. Cheers. Quote Link to comment https://forums.phpfreaks.com/topic/144024-solved-displaying-content-n-echoing-blank-information/#findComment-755708 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.