Whitespace in my tables

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Whitespace in my tables

Post by superdezign »

All of my editable content through my table creates about 3 tab whitespaces in front of text whenever it is submitted to the table.

Has anyone had this problem before?

The table data is of type TEXT, and it's updated through a simple UPDATE table SET blah=blah WHERE blah
User avatar
louie35
Forum Contributor
Posts: 144
Joined: Fri Jan 26, 2007 8:40 am
Location: Dublin
Contact:

Post by louie35 »

is the value comming from a textarea by any chance?
use

Code: Select all

trim($value)
before the insert statement
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Why, yes it is. My other company always uses FCKeditor, so I hadn't touched textareas in a while. Thank you

This get's rid of whitespace in the document it's displayted it, but trim isn't quite doing it for the text displayed inside of the textare. It no longers add more whitespace, but it keeps the initial 3 tabs, regardless of the application of trim(). I'll probably figure it out though.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Problem solved. The indentation in my code counted as textarea white space. How annoying is that? :-p
User avatar
louie35
Forum Contributor
Posts: 144
Joined: Fri Jan 26, 2007 8:40 am
Location: Dublin
Contact:

Post by louie35 »

yes indeed. a common mistake is to write textarea like this

Code: Select all

<textarea name='name'>
</textarea>

' when it should be

<textarea name='name'></textarea>
Post Reply