perezf Posted June 9, 2008 Share Posted June 9, 2008 Hello, I am currently trying to get data from a table in mysql In one field i have data separated by new lines How can i separate the data into bullets( meaning each new line a new bullet ) This is a sample of the data Line 1 Test Line 2 Test Line 3 Test Line 4 Test Line 5 Test Link to comment https://forums.phpfreaks.com/topic/109415-solved-how-do-i-break-data-up-with-new-lines/ Share on other sites More sharing options...
perezf Posted June 9, 2008 Author Share Posted June 9, 2008 Nevermind, i figured it out I exploded the info where ever there was a \n Link to comment https://forums.phpfreaks.com/topic/109415-solved-how-do-i-break-data-up-with-new-lines/#findComment-561235 Share on other sites More sharing options...
ILYAS415 Posted June 9, 2008 Share Posted June 9, 2008 What you could do is change your text file by making it something like... | Line 1 Test | Line 2 Test | Line 3 Test | Line 4 Test | Line 5 Test basically each line is seperated by '|'. Okay then in php you can do this... <?php $file= file_get_contents("file.txt"); //puts all the text/code from file.txt into one string; $string= explode("|", $file); //seperates the line by looking for the | seperator. for($i=0; $i < sizeof($string); $i++){ echo "• $string[$i] <br />"; //your string structure. } ?> Link to comment https://forums.phpfreaks.com/topic/109415-solved-how-do-i-break-data-up-with-new-lines/#findComment-561238 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.