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

  • basketmen
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Mar 21, 2007
  • Posts: 59
  • Status: Offline

Post February 14th, 2012, 11:15 am

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

screenshot
Image

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: [ Select ]
$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: [ Select ]
$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: [ Select ]
$xxx = explode("\r\n", "text1", "text2");




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



PHP Code: [ Select ]
$xxx = explode("\r\n", "text1");
$xxx = explode("\r\n", "text2");
 
  1. $xxx = explode("\r\n", "text1");
  2. $xxx = explode("\r\n", "text2");
  3.  




PHP Code: [ Select ]
$xxx = explode("\r\n", "text1" AND "text2");




PHP Code: [ Select ]
$xxx = explode("\r\n", "text1" . "text2");
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post February 14th, 2012, 11:15 am

  • Zealous
  • Expert
  • Expert
  • User avatar
  • Joined: Apr 15, 2011
  • Posts: 652
  • Loc: Sydney
  • Status: Offline

Post February 14th, 2012, 7:24 pm

why not just use mysql for the database instead of saving into files
  • demonmaestro
  • Gold Member
  • Gold Member
  • User avatar
  • Joined: Jun 21, 2006
  • Posts: 363
  • Loc: Conroe, Texas
  • Status: Offline

Post February 16th, 2012, 1:54 am

are you trying to display what info you have in your database?
Thanks, Josh --DemonMaestro
www.PlanetPeeps.com
Brand new Website www.ShoutsCloud.com
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 8678
  • Loc: Seattle, WA & Phoenix, AZ
  • Status: Online

Post February 17th, 2012, 9:54 am

basketman, it looks like to me you are trying to use the explode function to grab the values from your database. If that is the case that would be wrong. The PHP explode function is used to break up text in a string and store it in an array. So for instance if your variable:

PHP Code: [ Select ]
$text = "text1 text2";


Then you could store that in an array called $xxx by doing this:

PHP Code: [ Select ]
$xxx = explode(" ", $text);


Then you would have an array that looks like:

$xxx[0] is equal to "text1"
$xxx[1] is equal to "text2"

If this doesn't help answer your question, please clarify exactly what you are trying to do with your text, and where your text is coming from and if it is already stored in a variable called $text, or were you just giving an example?
Ozzu Hosting - Want your website on a fast server like Ozzu?

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 569 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.