473,405 Members | 2,261 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,405 software developers and data experts.

can't recover spaces from text put into mysql database table

1
Hi, I am using an html form to put a text into a Mysql database table. Using PHP V5

When I recover and display only one space between each word is seen irrespective of how many I add.

The spaces are all present in the database table. I just cant seem to recover them.

Can any onr help?

Regards

Baked
Feb 21 '10 #1

✓ answered by Atli

Yep, spaces are not treated the same way in HTML as they are in normal text. They have a specific purpose in the HTML markup, so they do not get rendered the same way they would in a normal text document.

There are three ways to get around this.
  1. As itsloop suggested, replace the space characters with   - This is the HTML entity used to represent a space inside the HTML markup.
  2. Wrap the text in <pre> or <code> tags. This will cause the contents of those elements to be rendered as plain-text.
  3. Add the "white-space: pre" CSS style to the element containing the text. This will make that element emulate the behavior of the <pre> element.

4 3067
itsloop
18
baked actually its HTML behavior it only displays only one space but if you view it in source view you will find theses for solving this problem replace the &nbsp; where you using space.
Feb 21 '10 #2
Atli
5,058 Expert 4TB
Yep, spaces are not treated the same way in HTML as they are in normal text. They have a specific purpose in the HTML markup, so they do not get rendered the same way they would in a normal text document.

There are three ways to get around this.
  1. As itsloop suggested, replace the space characters with &nbsp; - This is the HTML entity used to represent a space inside the HTML markup.
  2. Wrap the text in <pre> or <code> tags. This will cause the contents of those elements to be rendered as plain-text.
  3. Add the "white-space: pre" CSS style to the element containing the text. This will make that element emulate the behavior of the <pre> element.
Feb 21 '10 #3
itsloop
18
precised reply Atil. nice.
Feb 21 '10 #4
itsloop
18
in my understading html allows one charachter for providing easyness for the visitors and may if they space being used as entered then it would a very big problem for code indentation.
Feb 21 '10 #5

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

Similar topics

4
by: 21novembre | last post by:
Hi all, I'm working on my first php+mysql program. I have a mysqld running and there's a DB named "example" with a table "tbl". Here it is: -------------- mysql> use example; Reading table...
0
by: adrian GREEMAN | last post by:
When I try to import a text file with new data for an existing table I get the error "1148 - the used command is not allowed with this MySQL version." I have tried with both PHPMyAdmin2.3 and...
2
by: Snake Djip | last post by:
Hi, I have a database table which I wanted to backup. Stupid me, I only backed up the MYD and MYI file. I do not have the FRM file anymore. Is there a way to recover this data ?
3
by: Michael Lauzon | last post by:
This is not for a class, I have a group on SourceForge, this is what one of the Developers is asking; the more advanced you can make it right off all the better!: Can someone please create...
2
by: Richard Trahan | last post by:
I'm running 3.23.54 on Windows 98. I cannot access any tables of a database which previously worked fine and suddenly broke. I get Error 1017 errno: 2 from both mysqlcc 0.9.4 and mysqlc. The...
3
by: eieiohh | last post by:
MySQL 3.23.49 PHP 4.3.8 Apache 2.0.51 Hi All! Newbie.. I had a CRM Open Source application installed and running. Windows Xp crashed. I was able to copy the contents of the entire hard...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
10
by: Extremest | last post by:
I know there are ways to make this a lot faster. Any newsreader does this in seconds. I don't know how they do it and I am very new to c#. If anyone knows a faster way please let me know. All...
2
by: Extremest | last post by:
Here is the code I have so far. It connects to a db and grabs headers. It then sorts them into groups and then puts all the complete ones into another table. Problem I am having is that for some...
0
by: pcornaille | last post by:
HelHello, I used Mysql with a lot of databases (580 databases today). I have only one binary log for all theses databases. If I have to recover one database because a bad SQL stament has...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.