|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (10 bit)
|
php encode text upload to database
I have an article submission script that I wrote which uploads an article to a database. I then use php to access it again, only when i echo or print it, the line spaces dont show up. Therefore I'm looking to know if there is a way to encode a variable string which has line breaks to instead have
tags. It's basically how do I manage what this forum script does when someone uploads something like hello help me in order to get the line breaks into html. |
|
|
|
|
|
#2 |
|
Member (6 bit)
Join Date: Sep 2002
Location: Scotland
Posts: 50
|
Have you tried out the fread or fopen function to check if the line is blank?
I think at the end of each line, there is some sort of code that says '\r\n'. \r and \n means end of line. fread http://uk2.php.net/manual/en/function.fread.php fopen http://uk2.php.net/manual/en/function.fopen.php You could validate the length of the line say like PHP Code:
Last edited by Jova; 01-19-2004 at 03:29 AM. |
|
|
|
|
|
#4 |
|
Member (10 bit)
|
Thanks marving, ended up finding that solution when I started reading through a dedicated php forum. Also using the str_replace() as well.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|