homepage Welcome to WebmasterWorld Guest from 54.211.213.10
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
[Basic] Move a content, from database, to a php file
basketmen




msg:4417545
 6:19 pm on Feb 14, 2012 (gmt 0)

Hi guys, i have a content in one of phpmyadmin field

screenshot
[IMG]http://i291.photobucket.com/albums/ll284/basketmen/phpmyadminfield.jpg[/IMG]

the content is like this, its have two lines :
text1
text2






usually its called from a php file, using a variable, like this

[PHP]$#*$! = explode("\r\n", $text);[/PHP]



now i want to put the content, directly in the php file. This is working, to only put one line

[PHP]$#*$! = explode("\r\n", "text1");[/PHP]



But how is the right way to write both line? please help guys, i already tried these but no one works

[PHP]$#*$! = explode("\r\n", "text1", "text2");[/PHP]



[PHP]$#*$! = explode("\r\n", "text1, text2");[/PHP]


[PHP]
$#*$! = explode("\r\n", "text1");
$#*$! = explode("\r\n", "text2");
[/PHP]



[PHP]$#*$! = explode("\r\n", "text1" AND "text2");[/PHP]



[PHP]$#*$! = explode("\r\n", "text1" . "text2");[/PHP]

 

incrediBILL




msg:4417592
 8:21 pm on Feb 14, 2012 (gmt 0)

For starters, I would only use "\n" in the explode as unless you're only supporting Windows as I don't believe the "\r" is always present.

You can use trim per array element to get rid of the "\r" and other white noise.

To get to the second line, after the explode, you need to use a foreach() or just address them individually line text[0], text[1], etc. unless I'm misunderstanding the question.

Hard to comment on the rest as your variable is being filtered in your sample, what was that again? Put spaces between the letters or something so we can see what it is.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved