Miss-Ruth Posted November 5, 2009 Share Posted November 5, 2009 When I call "category" the entire ECHO items load.!!!! How should I adjust this code to load each item seperately. will something like a /n would do it??? { echo "category=".$line["category"]; echo "namez=".$line["namez"]; echo "CN1=".$line["col1"]; } Quote Link to comment https://forums.phpfreaks.com/topic/180385-solved-echo-problem/ Share on other sites More sharing options...
Bricktop Posted November 5, 2009 Share Posted November 5, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/180385-solved-echo-problem/#findComment-951608 Share on other sites More sharing options...
Miss-Ruth Posted November 5, 2009 Author Share Posted November 5, 2009 Thanks Bricktop!!! Quote Link to comment https://forums.phpfreaks.com/topic/180385-solved-echo-problem/#findComment-951610 Share on other sites More sharing options...
Miss-Ruth Posted November 5, 2009 Author Share Posted November 5, 2009 what if it's in XML?? could any adjustments be done to the echos, so it out puts seperatly. I've assigned variables. but when I call them it all loads as a single line!!! Quote Link to comment https://forums.phpfreaks.com/topic/180385-solved-echo-problem/#findComment-951613 Share on other sites More sharing options...
Daniel0 Posted November 5, 2009 Share Posted November 5, 2009 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". Quote Link to comment https://forums.phpfreaks.com/topic/180385-solved-echo-problem/#findComment-951618 Share on other sites More sharing options...
Miss-Ruth Posted November 5, 2009 Author Share Posted November 5, 2009 Thanks Daniel. But since I'ev assigned varianles here (for each echo), shouldn't it load only the one assigned to it? but here it's a 'foobar'!! Quote Link to comment https://forums.phpfreaks.com/topic/180385-solved-echo-problem/#findComment-951622 Share on other sites More sharing options...
Bricktop Posted November 5, 2009 Share Posted November 5, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/180385-solved-echo-problem/#findComment-951624 Share on other sites More sharing options...
Miss-Ruth Posted November 5, 2009 Author Share Posted November 5, 2009 That help me solve my prob! As always - Thanks Bricktop!! <3 Quote Link to comment https://forums.phpfreaks.com/topic/180385-solved-echo-problem/#findComment-951625 Share on other sites More sharing options...
Daniel0 Posted November 5, 2009 Share Posted November 5, 2009 With XML try using /n to create a linebreak, like so: It's \n though, not /n. Quote Link to comment https://forums.phpfreaks.com/topic/180385-solved-echo-problem/#findComment-951626 Share on other sites More sharing options...
Bricktop Posted November 5, 2009 Share Posted November 5, 2009 With XML try using /n to create a linebreak, like so: It's \n though, not /n. lol, ty Daniel, I knew that really...... Quote Link to comment https://forums.phpfreaks.com/topic/180385-solved-echo-problem/#findComment-951628 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.