compguru910 Posted July 4, 2008 Share Posted July 4, 2008 Ok, I am having a problem, and I do not know how to go about fixing it. I am designing a website for a local crime stoppers organization and everything was going fine until this. I have made it so that they can upload crimes through a set of forms, so that they will display on the website. Well, when you enter a long description of the crime with multiple breaks in it, and submit it, it stores it in the database. But, when I tell it to print to the screen, it takes all of the breaks out, leaving one big paragraph. Anyone know how to fix this? Shaun example here http://www.n-volved.com/stopcrime/crimes.php?crime_lookup=31 Link to comment https://forums.phpfreaks.com/topic/113225-text-and-mysql/ Share on other sites More sharing options...
papaface Posted July 4, 2008 Share Posted July 4, 2008 either: echo nl2br($data); or echo "<pre>". $data) . "</pre>"; Link to comment https://forums.phpfreaks.com/topic/113225-text-and-mysql/#findComment-581677 Share on other sites More sharing options...
DarkWater Posted July 4, 2008 Share Posted July 4, 2008 When you take it out of the DB, use nl2br() on the text to replace the newlines with line break tags. Link to comment https://forums.phpfreaks.com/topic/113225-text-and-mysql/#findComment-581678 Share on other sites More sharing options...
compguru910 Posted July 4, 2008 Author Share Posted July 4, 2008 Wow guys, thanks. I have been programming in PHP for a year now and I had no idea about that. You guys are great. Kudos to you Link to comment https://forums.phpfreaks.com/topic/113225-text-and-mysql/#findComment-581681 Share on other sites More sharing options...
DarkWater Posted July 4, 2008 Share Posted July 4, 2008 No problem. Don't use it before entering it in the DB though, because then it'll be a problem to display in text boxes (for editing). =) Link to comment https://forums.phpfreaks.com/topic/113225-text-and-mysql/#findComment-581682 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.