An automatic creation problem for TP

Source: Internet
Author: User
The method above the manual is
$up->create ();
$up->add (); Then you don't have to write the sub-paragraph by yourself.

But if I have only two values in my form, but there are 4 fields in the database, how does this method know that the two values of my form are inserted into those two fields?
My form notation
{$note}


The way I'm using it right now
               $data [' aname ']=$_post[' user ']; $data [' Apwd ']=md5 ($_post[' pwd '); $data [' Bak ']=$_post[' pwd '];if ($_post[' user ']== ') ') {$this->error (' Please enter username '); exit ();} if ($_post[' pwd ']== ') {$this->error (' Password not entered, please check carefully '); exit (); $count = $upadmin->add ($data);


My database has 4 fields, the value of the form is only two, one is the user name, one is the password, insert the database has three values, one is the user name, one is encrypted MD5, one is not encrypted.


If you use automatic, how to insert, if you want to use an array, one by one to write, it is not the same, it is not automatic, such as a form has 100+ values to insert the database, it is not very troublesome.


Now my goal is to use an automatic method to insert into the database.


Reply to discussion (solution)



This is the database field.

Oh, you only see the Simple $up->create (); A bit
But didn't see the preparatory work.

Oh, you only see the Simple $up->create (); A bit
But didn't see the preparatory work.

Yes, I get it, thanks.

  • 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.