PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Thu May 25, 2017 12:03 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Tue Jan 12, 2016 11:04 pm 
Offline
Forum Newbie

Joined: Tue Jan 12, 2016 10:58 pm
Posts: 1
How can I read a blob field that has been pulled from the database and has formatted text?
I need to be able to read line by line in order to populate a table, basically get the contents from each line. thanks


Top
 Profile  
 
PostPosted: Wed Jan 13, 2016 12:36 pm 
Offline
Site Administrator
User avatar

Joined: Wed Aug 25, 2004 7:54 pm
Posts: 13396
Location: New York, NY, US
Probably the easiest is to split the text on newlines into an array. The simplest would be:
Syntax: [ Download ] [ Hide ]
$lines = explode("\n", $text);     // or \r

If line endings can be mixed then more complicated:
Syntax: [ Download ] [ Hide ]
$lines = preg_split("/((\r?\n)|(\r\n?))/", $text);

Then just
Syntax: [ Download ] [ Hide ]
 foreach($lines as $line) {

_________________
(#10850)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Yahoo [Bot] and 8 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

Jump to:  
Powered by phpBB® Forum Software © phpBB Group