How can PHP get the post value in bulk and store it in the database?

Source: Internet
Author: User
Novice ask PHP How to bulk get post value and stored in the database!
$data =array ();
$data [' A ']=in ($_post[' a ']);
$data [' B ']=in ($_post[' B ');
$data [' C ']=in ($_post[' c]);
$data [' d ']=in ($_post[' d ']);
$data [' AA ']=in ($_post[' AA ');
$data [' A1 ']=in ($_post[' A1 ');
.................. omitted here
Model (' Xitong ')->update ("Id=1", $data);

The above is a normal update of the database PHP code

However, the current problem is that there are more than 50 fields in this table for your needs. And like
$data [' A ']=in ($_post[' a ']), so the format of a line input, it feels very unscientific.
Can you get the post value in bulk by field name and update to the database together?

------Solution--------------------
First, if the Psot pass a database, the key will be an error.
All I say to do field filter
You can use this method if you don't always insert all the fields.

The second is to check that each field is not a value
If all fields are inserted every time, you can use this release

Each has its own benefits to see how people use
  • Related Article

    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.