hello
I have stored a paragraph in mysql database and when i try to retrive it and sisplay i want to format the paragrapg...
The paragraph is like this
1.some text 2.again some text 3.again some text 4.again some text
I want my output to be like this
1.some text
2.again some text
3.again some text
4.again some text
and so on
i am able to retrive the praragrapg in a variable like the variable is $paragraph
now i dont no how to cut the line after a number and point(fullstop)
Please Help me guys...its urgent
THANKING YOU IN ADVANCE
Formatting a value retirved from database
Moderator: General Moderators
Re: Formatting a value retirved from database
Hi,
you can use preg_replace.
Reg-Ex: "([0-9]+)." replace with "<br />$1."
you can use preg_replace.
Reg-Ex: "([0-9]+)." replace with "<br />$1."
Last edited by Hannes2k on Wed Nov 19, 2008 8:34 am, edited 1 time in total.
Re: Formatting a value retirved from database
Is it possible this text originated in a textarea? if that's the case it has line-breaks which can be converted to html breaks using nl2br().
Re: Formatting a value retirved from database
yes the text originate in text area,how to convert line break into html code,cam you please give me the code
Re: Formatting a value retirved from database
THANKS A LOT
I am able to solve the issue.thanks once again.
As suggested by you i have used the function nl2br and able to get the result as i wanted.
I am able to solve the issue.thanks once again.
As suggested by you i have used the function nl2br and able to get the result as i wanted.