Scorpion28 Posted December 1, 2011 Share Posted December 1, 2011 Ok so I have this site where I'm posting a message to my Database. But when I go to pull the message from the MYSQL DB it's one long sentence. Any suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/252260-php-to-mysql-database-back-to-site/ Share on other sites More sharing options...
Spring Posted December 1, 2011 Share Posted December 1, 2011 I have a site where I pull mysql from the database, but it's a short sentence. Quote Link to comment https://forums.phpfreaks.com/topic/252260-php-to-mysql-database-back-to-site/#findComment-1293281 Share on other sites More sharing options...
QuickOldCar Posted December 1, 2011 Share Posted December 1, 2011 Some code related to what you are doing usually helps. Displaying data in php with line breaks should use <br /> If you have an extremely long paragragh, you can use wordwrap. http://php.net/manual/en/function.wordwrap.php Quote Link to comment https://forums.phpfreaks.com/topic/252260-php-to-mysql-database-back-to-site/#findComment-1293282 Share on other sites More sharing options...
PFMaBiSmAd Posted December 1, 2011 Share Posted December 1, 2011 Use nl2br when you output the data. Quote Link to comment https://forums.phpfreaks.com/topic/252260-php-to-mysql-database-back-to-site/#findComment-1293283 Share on other sites More sharing options...
Scorpion28 Posted December 2, 2011 Author Share Posted December 2, 2011 it's a standard input php form to a mysql table how do I display the paragraph as a paragraph. Quote Link to comment https://forums.phpfreaks.com/topic/252260-php-to-mysql-database-back-to-site/#findComment-1293291 Share on other sites More sharing options...
Eiolon Posted December 2, 2011 Share Posted December 2, 2011 If you did not enter it into the database with line breaks, you can use the wordwrap function in PHP to tell it when to line break. http://php.net/manual/en/function.wordwrap.php Quote Link to comment https://forums.phpfreaks.com/topic/252260-php-to-mysql-database-back-to-site/#findComment-1293306 Share on other sites More sharing options...
Scorpion28 Posted December 2, 2011 Author Share Posted December 2, 2011 Still need help here is the input method if(isset($_POST['submit'])=="edit") { if(isset($_POST['title']) && $_POST['title'] != '') {$title = trim($_POST['title']);} else{$title = false;} if(isset($_POST['descr']) && $_POST['descr'] != '') {$descr = trim($_POST['descr']);} else{$descr = false;} $M = $_POST['M']; $F = $_POST['F']; $T = $_POST['T']; if($title && $descr) { $result=mysql_query("INSERT INTO nsa(ee_id,title,descr,M,F,T,date)VALUES('".$_SESSION["EEID"]."','$title','$descr','$M','$F','$T', now())"); if($result) EX: Testing One Two Quote Link to comment https://forums.phpfreaks.com/topic/252260-php-to-mysql-database-back-to-site/#findComment-1293585 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.