简体   繁体   中英

Leading spaces in textarea from MySQL

I'm retrieving data from a mysql table column and placing it into a textarea.

When I do this, I get a huge section of leading spaces for only the first row of data. I've tried using mysql TRIM and PHP TRIM functions, and neither of them seem to work. Additionally, when I query the database directly, there are no leading spaces:

+-----------------+
| article_content |
+-----------------+
| # Test
        |
+-----------------+

Has anyone had this issue before?

在此处输入图片说明

This happens more often than not, but I try for several hours to fix something and can't figure it out, and then I post here on stack overflow, and then the answer hits me.

The issue was with my HTML section. I forgot that textarea will interpret all spaces and tabs, etc, so when I indented my code that is inside some PHP code, it interpreted it, and inserted the spaces/tabs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM