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

  • basketmen
  • Student
  • Student
  • basketmen
  • Posts: 68

Post 3+ Months Ago

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
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Zealous
  • Guru
  • Guru
  • User avatar
  • Posts: 1240
  • Loc: Sydney

Post 3+ Months Ago

why not just use mysql for the database instead of saving into files
  • demonmaestro
  • Gold Member
  • Gold Member
  • User avatar
  • Posts: 651
  • Loc: Conroe, Texas

Post 3+ Months Ago

are you trying to display what info you have in your database?
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9084
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

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?

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 42 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
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.