MySQL field at the beginning of the space how to clear

Source: Internet
Author: User

Name field, a space is added in front of the data you put in (PS, the first few data I manually modified). This affects the subsequent lookups. The INSERT statement I used is:

Insert into User (Name,password,email,create_time) VALUES (' $name ', ' $password ', ' $email ', ' $time ')

Where the field name is in the form varchar (45). There are two ways to end the Web, the first is to use the PHP str_replace function to clear spaces and special characters, and then still add space.

The second is the use of the MySQL statement trim, will still add space.

Later I immediately replaced the $name with a string, found the space.

So I think it should be the internal MySQL thing, tracking here will not go on. I hope someone can answer them.

Reply content:

Name field, a space is added in front of the data you put in (PS, the first few data I manually modified). This affects the subsequent lookups. The INSERT statement I used is:

Insert into User (Name,password,email,create_time) VALUES (' $name ', ' $password ', ' $email ', ' $time ')

Where the field name is in the form varchar (45). There are two ways to end the Web, the first is to use the PHP str_replace function to clear spaces and special characters, and then still add space.

The second is the use of the MySQL statement trim, will still add space.

Later I immediately replaced the $name with a string, found the space.

So I think it should be the internal MySQL thing, tracking here will not go on. I hope someone can answer them.

There is also a varchar type field in front of name, which can be deleted. Unknown so ~ ~ ~

You need to give a look at the definition of the table ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.