Webmaster Forum


Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
Share |
  #1 (permalink)  
Old 02-14-2012, 10:13 AM
Contributing Member
Latest Blog:
None

 
Join Date: 03-21-07
Posts: 88
iTrader: 0 / 0%
[Basic] Move a content, from database, to a php file

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

screenshot


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




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

PHP Code:
$xxx explode("\r\n"$text); 


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

PHP Code:
$xxx explode("\r\n""text1"); 


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

PHP Code:
$xxx explode("\r\n""text1""text2"); 


PHP Code:
$xxx explode("\r\n""text1, text2"); 

PHP Code:
$xxx explode("\r\n""text1");
$xxx explode("\r\n""text2"); 


PHP Code:
$xxx explode("\r\n""text1" AND "text2"); 


PHP Code:
$xxx explode("\r\n""text1" "text2"); 
__________________
I like forum
 
Reply With Quote
  #2 (permalink)  
Old 02-14-2012, 11:08 AM
ScriptMan's Avatar
Super Moderator
 
Join Date: 02-10-07
Location: Central Kentucky
Posts: 10,263
iTrader: 4 / 100%
If it is text, why can't you just echo the row?

If the newlines are a problem just strip them out of the string before you echo it.
__________________
SEO does not mean Spam Everywhere Online
Scriptman's Playhouse || Ramblings from an old man
2013 resolution: Don't feed trolls
ScriptMan
 
Reply With Quote
  #3 (permalink)  
Old 02-14-2012, 11:11 AM
Contributing Member
Latest Blog:
None

 
Join Date: 03-21-07
Posts: 88
iTrader: 0 / 0%
i am sorry, can you give example please? i am still newbie in programming
__________________
I like forum
 
Reply With Quote
  #4 (permalink)  
Old 02-14-2012, 05:49 PM
RiptideTempora's Avatar
Contributing Member
 
Join Date: 11-30-11
Location: Orlando, FL
Posts: 220
iTrader: 0 / 0%
Quote:
Originally Posted by basketmen View Post
i am sorry, can you give example please? i am still newbie in programming
PHP Code:
echo $text
or if you wanted to add <br /> tags without excess:
PHP Code:
echo nl2brtrim($text) );
// OR
echo implode("<br />\r\n"explode("\r\n"trim($text) ) ); 
__________________
This Link Will Self-Destruct
Keenotes - A place for sharp minds
 
Reply With Quote
  #5 (permalink)  
Old 02-14-2012, 06:32 PM
ScriptMan's Avatar
Super Moderator
 
Join Date: 02-10-07
Location: Central Kentucky
Posts: 10,263
iTrader: 4 / 100%
Or replace the \n\r with <br>.

It all depends on what you are trying to do.

Tell us more and one of us will offer something worth you time. What do you have and what are you trying to do?
__________________
SEO does not mean Spam Everywhere Online
Scriptman's Playhouse || Ramblings from an old man
2013 resolution: Don't feed trolls
ScriptMan
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
huge file in MYSQL database pjeremy90 Coding Forum 6 06-26-2011 05:16 PM
phpbb3 database move to vbulletin buzzcom Forum Management 8 11-21-2010 09:25 AM
How to move SQl database seonewbee Web Hosting Forum 2 12-24-2004 03:34 PM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 12:24 AM.
Powered by vBulletin
Copyright © 2000-2013 Jelsoft Enterprises Limited.
Copyright © 2003 - 2013 Escalate Media LP




Search Engine Optimization by vBSEO 3.6.0 RC 2 ©2011, Crawlability, Inc.