echo "This spans\nmultiple lines. The newlines will be\noutput as well.";
stevek wrote:[color=blue]
> Following code does not produce any new lines. Any ideas.
>
> echo "This spans\multiple lines. The newlines will be\noutput as well.";[/color]
Carved in mystic runes upon the very living rock, the last words of
stevek of comp.lang.php make plain:
[color=blue]
> stevek wrote:[color=green]
>> Following code does not produce any new lines. Any ideas.
>>
>> echo "This spans\multiple lines. The newlines will be\noutput as
>> well.";[/color]
>
> Sorry ... spell checker corrected some.
>
> echo "This spans\nmultiple lines. The newlines will be\noutput as
> well.";[/color]
So, you're saying that this will output the literal string:
This spans\nmultiple lines. The newlines will be\noutput as well.
Is the bit you posted above a direct cut-and-paste from your script? If
not, check that you are in fact using double quotes and not single.
HTML ignores excess whitespace including newlines. Are you viewing the
page in the browser or viewing the source for the page? If you are
viewing the output in the browser window itself, is the text contained
in a PRE tag?
$conn = @mysql_connect( "campania", "sfk", "" )
or die( "Sorry - could not connect to MySQL" );
echo "$conn\n";
//$rs1 = @mysql_create_d b( $_REQUEST['db'] );
echo "This spans\nmultiple lines. The newlines will be\noutput as well.";
?>
produces......
Resource id #2 This spans multiple lines. The newlines will be output as
well.
Alan Little wrote:[color=blue]
> Carved in mystic runes upon the very living rock, the last words of
> stevek of comp.lang.php make plain:
>[color=green]
>> stevek wrote:[color=darkred]
>>> Following code does not produce any new lines. Any ideas.
>>>
>>> echo "This spans\multiple lines. The newlines will be\noutput as
>>> well.";[/color]
>> Sorry ... spell checker corrected some.
>>
>> echo "This spans\nmultiple lines. The newlines will be\noutput as
>> well.";[/color]
>
> So, you're saying that this will output the literal string:
>
> This spans\nmultiple lines. The newlines will be\noutput as well.
>
> Is the bit you posted above a direct cut-and-paste from your script? If
> not, check that you are in fact using double quotes and not single.
>[/color]
rlee0001 wrote:[color=blue]
> HTML ignores excess whitespace including newlines. Are you viewing the
> page in the browser or viewing the source for the page? If you are
> viewing the output in the browser window itself, is the text contained
> in a PRE tag?
>
> -Robert
>[/color]
All you need to do is statement separator (the period (.)). Then put
your code in two statements such as this.
Line #5 is [echo "$conn\n";]
Line #5 needs to be corrected to [echo $conn."\n";]
LIne #7 is [echo "This spans\nmultiple lines. The newlines will
be\noutput as well."; ]
Line #7 needs to be
[echo "This spans"."\n"."mu ltiple lines. The newlines will
be"."\n"."outpu t as wee.";]
stevek wrote:[color=blue]
> Please see prior post.
>
> rlee0001 wrote:
>[color=green]
>> HTML ignores excess whitespace including newlines. Are you viewing the
>> page in the browser or viewing the source for the page? If you are
>> viewing the output in the browser window itself, is the text contained
>> in a PRE tag?
>>
>> -Robert
>>[/color][/color]
Steve,
No, you see Robert's post. He is correct. Check the page source.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. jstucklex@attgl obal.net
=============== ===
Carved in mystic runes upon the very living rock, the last words of
stevek of comp.lang.php make plain:
[color=blue]
> Alan Little wrote:[color=green]
>> Carved in mystic runes upon the very living rock, the last words of
>> stevek of comp.lang.php make plain:
>>[color=darkred]
>>> stevek wrote:
>>>> Following code does not produce any new lines. Any ideas.
>>>>
>>>> echo "This spans\multiple lines. The newlines will be\noutput as
>>>> well.";
>>> Sorry ... spell checker corrected some.
>>>
>>> echo "This spans\nmultiple lines. The newlines will be\noutput as
>>> well.";[/color]
>>
>> So, you're saying that this will output the literal string:
>>
>> This spans\nmultiple lines. The newlines will be\noutput as well.
>>
>> Is the bit you posted above a direct cut-and-paste from your script?
>> If not, check that you are in fact using double quotes and not
>> single.
>>[/color]
> <?php
>
> $conn = @mysql_connect( "campania", "sfk", "" )
> or die( "Sorry - could not connect to MySQL" );
> echo "$conn\n";
> //$rs1 = @mysql_create_d b( $_REQUEST['db'] );
> echo "This spans\nmultiple lines. The newlines will be\noutput as
> well."; ?>
>
> produces......
>
> Resource id #2 This spans multiple lines. The newlines will be output
> as well.[/color]
If you mean it outputs this in your browser (I don't see a shebang line,
so I assume you're not running this on the command line), then Robert
gave you the answer. A newline is equivalent to a space, in HTML.
huckphin wrote:[color=blue]
> All you need to do is statement separator (the period (.)). Then put
> your code in two statements such as this.
>
> Line #5 is [echo "$conn\n";]
> Line #5 needs to be corrected to [echo $conn."\n";]
>
> LIne #7 is [echo "This spans\nmultiple lines. The newlines will
> be\noutput as well."; ]
> Line #7 needs to be
> [echo "This spans"."\n"."mu ltiple lines. The newlines will
> be"."\n"."outpu t as wee.";][/color]
stevek wrote:[color=blue]
> Following code does not produce any new lines. Any ideas.
>
> echo "This spans\multiple lines. The newlines will be\noutput as well.";[/color]
huckphin wrote:[color=blue]
> All you need to do is statement separator (the period (.)). Then put
> your code in two statements such as this.
>
> Line #5 is [echo "$conn\n";]
> Line #5 needs to be corrected to [echo $conn."\n";]
>
> LIne #7 is [echo "This spans\nmultiple lines. The newlines will
> be\noutput as well."; ]
> Line #7 needs to be
> [echo "This spans"."\n"."mu ltiple lines. The newlines will
> be"."\n"."outpu t as wee.";]
>
> -Huck Finn
>[/color]
Sorry, Huck. It will all come out in one line. Try it yourself in an HTML page.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. jstucklex@attgl obal.net
=============== ===
Yea, so my previous post was wrong. For some reason I was thinking
that stevek was referring to the output inside the source code to make
go to a new line. My mistake. Thank you for the correction, though.
Comment