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

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

screenshot


the content is like this, its have two lines :
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"); 
#basic #content #database #file #move #php
  • Profile picture of the author Nochek
    $xxx = explode("rn", $text);

    That is all you need. What that is doing is taking the $text variable and 'exploding' each line, giving you back an array ($xxx) of lines.

    Try using:

    echo $xxx[1];

    After that line, and you will see the second line output (arrays in php start counting at 0, so for each line it will be $xxx[0], $xxx[1], $xxx[2], etc etc)
    Signature
    Nochek Solutions Presents:
    The Hydrurga WSO - Rank Your Site #1 And Score Over The Penguin Updates!
    {{ DiscussionBoard.errors[5621346].message }}
    • Profile picture of the author michael_gourlay
      Not sure what you are going for here, but:

      $xxx = explode("\r\n", "text1\r\ntext2");
      {{ DiscussionBoard.errors[5622171].message }}

Trending Topics