Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Phantom "\n" echoed on page

Status
Not open for further replies.

irbk

MIS
Oct 20, 2004
578
US
I'm looping through the following code
*****Start Code*****
echo '<tr>
<td colspan="3">
<span class="style13">'. $row['title'] . '</span>
<span class="style16"><BR>' . $row['content'] . '
<a href="../newsletter" target="_blank">[more]</a>
</span>
</td>
</tr>
<tr>
<td colspan="3">
<span class="style21">
<img src="../images/slice_07.gif" width="599" height="10">
</span>
</td>
</tr>\n';

It works fine, loops through and prints out everything right, but I keep getting "\n" at the top of the page for every record it loops through. Can't figure out why. Any help would be much appreshated.

Thanks in advance.
 
That would be this part of your string:

</tr>\n';

You're using a single-quoted string, and single-quoted strings are not interpolated. Where:

print "\n";

will output a newline (because of double-quoted string interpolation) this:

print '\n';

will only output the literal characters "[backslash][n]".



Want the best answers? Ask the best questions! TANSTAAFL!
 
That's weird because I've used a '\n'; before and never had an issue with it. Oh well, that's what did the trick.
Thanks!
 
Probally is there but didn't notice it. Consider my lesson learned "\n;" from now on it is!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top