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

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




the content is like this, its have two lines :




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"); 
#programming #basic #content #database #file #move #php
  • $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)
    • [1] reply
    • Not sure what you are going for here, but:

      $xxx = explode("\r\n", "text1\r\ntext2");

Next Topics on Trending Feed