I have a column in a mysql table which has extra whitespaces on the end. Although i already tried to do REPLACE and TRIM within mysql and $output = preg_replace("/\s+/", " ", $input);
nothing seems to remove the extra whitespace or whatever it is in the end of the string.
The column is a varchar(255) collation utf8_general_ci. It contains an alphanumeric string which represents a flight number e. g. LH2214. I have another column which also is the same collation and also varchar(255) with the same alphanumeric strings, which doesn't have the extra whitespace after it.
I only can see the whitespace on my webpage, which has charset utf-8. But what i can't see is, if it is a tabspace, whitespace, eol, eof or similar, so i don't know how to filter it out. Does anybody have any ideas how do i get rid of the extra whitespace in the end of the values in my column in mysql?
I already tried a lot of solutions posted to similar questions her on SO, but none worked.
I added an image to show my problem.
The funny thing is, that in the source-code, there is no whitespace visible. So if I save the html, i will not see an whitespace nor an
or similar.
Looks to me (from your screenshot), that you have some additional CSS properties on the rows that have the "additional whitespace". Take a look at your css properties, perhaps you set a margin, padding, text-indent or some other property that would shift your text/content.
Two possible reasons for the additional whitespace come to my mind.
You can verify and fix this ( for existing data ) Using the following Query:
UPDATE <your_table> SET <your_column> = TRIM ( <your_column> );
If this worked you should have a confirmation 'n rows updated' with n > 0
Check your output HTML and Stylesheets