473,385 Members | 1,333 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to format text retrieved from an MSQL Database

I have an application that writes text to a MySQL data base from an HTML form. The text in the MySQL table retains the formatting in the form (line breaks etc.) However when I retrieve the text and display it in an HTML layer all the formatting is gone.

Is there any way PHP can retrieve the formatting from the database?There's no way I can write code to do the formatting because I don't know how it was originally entered.
Aug 6 '07 #1
3 2245
jx2
228 100+
i think u need this

u might try wordwrap(); too

hope tht help
jx2
Aug 6 '07 #2
Hi,

I found a solution;

<?php echo nl2br(str_replace(" ","&nbsp",stripslashes($row["textsum"]))); ?>

the nl2br function puts line breaks in and the str_replace puts the spaces back in.
Aug 7 '07 #3
ak1dnar
1,584 Expert 1GB
Hi,

I found a solution;

<?php echo nl2br(str_replace(" ","&nbsp",stripslashes($row["textsum"]))); ?>

the nl2br function puts line breaks in and the str_replace puts the spaces back in.
Glad you got it working. post back any time if you have any issues!
Aug 7 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Richard The Lost | last post by:
I am trying to create a mask for a time value typically of 02:23.45 and while I can get the mask to show in the box when it loses focus it rounds the number in some way to 02:24. I want to put...
0
by: Webmaster | last post by:
Hi everyone... I know this isn't strictly a php/mysql ng, but I was hoping maybe someone here knows both languages and is willing to help. I have a directory of text files that i'd like to...
4
by: Bernie Hunt | last post by:
I'm looking for information on how to format a strings in a Datagrid. The application has telephone numbers coming from a database and they are a string of 10 digits. I would like to add in the "-"...
7
by: Richiep | last post by:
I am trying to get a UK format date of dd/mm/yyyy. Why does the following subroutine not return a valid date in a web form? The date returned is #12:00:00 AM# but the date I entered into the...
6
by: Ted | last post by:
I used bcp to produce the apended format file. How can it be modified to recognize the quotes that surround the text fields and not insert the quotes along with the text? Invariably, the first...
0
by: MatchSQL | last post by:
When we want to save the database schema and SQL statement , we use the backup of SQLServer provide, but it always content the running data, now a new tool named MatchSQL, it can just save...
7
by: basyarie | last post by:
Dear VB mania, especially VB6 specialist I have a problem with my GPS. So far, I have a GPS-M1zz from Pioneer Navicom company. It has 2 type of data format, i.e. Pioneer Format and NMEA data...
11
by: newtodotnet1 | last post by:
Hi all, I retrieved data from database and i want to display the retrieved data in xml format in aspx page using asp.net and c#.net... Please get me the code.. i am using asp.net and c#.net ...
4
by: jeet123 | last post by:
hi, i am new to c#. How can i make a form which displays data in a tabular format where the data is retrieved from the database (ms-access) and displayed in that from in table. No matter if the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.