Jump to content

[SOLVED] ECHO problem


Miss-Ruth

Recommended Posts

Hi Miss-Ruth,

 

It depends on where you are outputting this info (on an HTML page or via XML) but adding a line break will work if you're echoing to HTML.

 

Change your code to read:

 

{
echo "category=".$line["category"]."<br/>";
echo "namez=".$line["namez"]."<br/>";
echo "CN1=".$line["col1"]."<br/>";
}

 

Hope this helps.

Link to comment
https://forums.phpfreaks.com/topic/180385-solved-echo-problem/#findComment-951608
Share on other sites

PHP outputs things exactly as you tell it to. If you want newlines, HTML line breaks, tab characters, etc. you'll have to add it yourself.

 

If you said 'output "foo" then output "bar"', it would be incorrect if it output "foo\nbar", "foo<br />bar", "foo<br>bar" or anything different from "foobar".

Link to comment
https://forums.phpfreaks.com/topic/180385-solved-echo-problem/#findComment-951618
Share on other sites

Hi Miss-Ruth,

 

Your echo command as it stands:

 

{
echo "category=".$line["category"]."<br/>";
echo "namez=".$line["namez"]."<br/>";
echo "CN1=".$line["col1"]."<br/>";
}

 

Will echo all three variables regardless of what's assigned to what. 

 

With XML try using /n to create a linebreak, like so:

 

{
echo "category=".$line["category"]."/n";
echo "namez=".$line["namez"]."/n";
echo "CN1=".$line["col1"]."/n";
}

 

If you only want "category" to be echo'd just do:

 

{
echo "category=".$line["category"];
}

 

But I'm not sure what implications this will have on your application, you may want the other data to be echo'd out.

Link to comment
https://forums.phpfreaks.com/topic/180385-solved-echo-problem/#findComment-951624
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.