How does PHP store and query string data on MYSQL?

Source: Internet
Author: User
How does PHP store and query string data in MYSQL? I have such data. Monday morning: Chinese afternoon: Math Tuesday morning: English Afternoon: Physics Thursday morning: sports afternoon: music Thursday morning: Chemistry afternoon: Art Friday morning: history afternoon: how politics stores data in a field of a table in string mode. How to write the syntax? How can I query data after storage? How do I update the values in the morning and afternoon? I remember reading this article before, similar to [{Monday: Chinese, Mathematics}. {beginner asked PHP how to store and query string data in MYSQL?
I have such data.
Monday
Morning: Chinese
Afternoon: Mathematics

Tuesday
Morning: English
Afternoon: Physical

Wednesday
Morning: Sports
Afternoon: Music

Thursday
Morning: Chemistry
Afternoon: Art

Friday
Morning: history
Afternoon: politics


How to store a table field in string mode. How to write the syntax? How can I query data after storage? How do I update the values in the morning and afternoon?

I remember reading this article before,
Similar
[{Monday: Chinese, Mathematics}, {Tuesday: English, physics},]
But I don't know how to write or use the syntax.

Requirement: query and update.

Please give me some advice. Or give me a related article.
------ Solution --------------------

$ Arr = array (
'Monday' => 'Chinese, mat ',
'Tuesday' => 'English, physical ',
'Wedned' => 'sports, music ',
'Thurs' => 'chemistry, artbe ',
'Friday' => 'historical, political'
);
$ Result = json_encode ($ arr );
Echo $ result; // save as a database
// Retrieve from database
$ Arr = json_decode ($ result, true );
Print_r ($ arr );

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.