Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.