How does PHP read data when the database is a string?

Source: Internet
Author: User
How does PHP read data when the database is a string? This post is finally edited by c520zf1986 at 2014-04-0110:44:39. Example 1: The content of a field in MYSQL database is in the format of, and 7, how can I read and store updates in PHP? If I want to read the fourth digit, that is, 46, in PHP format, how can a beginner ask how PHP reads a string when the database is a string?

This post was last edited by c520zf1986 at 10:44:39, January 1 ,.

Example 1: The content of a field row in MYSQL database is:, 7
In this format, how can I read and store updates using PHP?
If I want to read the fourth digit, that is, 46, in PHP format, how can I write it? If I want to read the first and last numbers, how can I write the format? What if I need to add another number after the last number?

Example 2: The content of another field is a: 20, B: 55, I: 75.
How can I read and update such a format?
------ Solution --------------------
Select SUBSTRING_INDEX ('1, ', 4),', ',-1) as fourth
Fourth
46

Use php to read and split it into arrays

It seems that you have saved space and wasted time and brain cells.

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.