Forum Moderators: coopster

Message Too Old, No Replies

Added spaces at the beginning of a MySQL text field

MySQL spaces

         

feralo

6:34 am on Oct 17, 2005 (gmt 0)

10+ Year Member



Hey friends!
i am working on a content management system and i notice that one field in a table (the 'text' field) adds a space to the beginning of the entry on every save, not a huge deal but it is really annoying- any suggestions?
Thanks allot!

dcrombie

10:27 am on Oct 17, 2005 (gmt 0)



I'm guessing a bit here, but you probably have a TEXTAREA set up as:

<TEXTAREA> 
value echo'd here
</TEXTAREA>

instead of:

<TEXTAREA>value echo'd here</TEXTAREA>

That would result in a space or line break being prepended on each save.

;)

dmmh

5:52 pm on Oct 17, 2005 (gmt 0)

10+ Year Member



or you could use trim() to trim whitespace :)

I think its the better option anyway, if a user types a space and you dont use trim, it will still show the space ;)

feralo

6:12 pm on Oct 17, 2005 (gmt 0)

10+ Year Member



Perfect!
Both of those are excellent tips!
i can't wait to implement them when i get home this afternoon!
Thank you both!