The php framework does not need to write SQL statements to call the fields of tables in the database. how can this problem be achieved?

Source: Internet
Author: User
The php framework does not need to write SQL statements to call how the fields of tables in the database are implemented. This post was last edited by albb_num1 from 2014-10-2023:. it is said that many frameworks do not need to write SQL statements, it is incredible how the fields of data tables can be called by encapsulation alone. because traditional tutorials all say that databases cannot be operated without SQL statements, what is the problem? the php framework does not need to write SQL statements to call the fields of tables in the database. how can this problem be achieved?

This post was last edited by albb_num1 at 23:13:07

It is said that many frameworks do not need to write SQL statements and can call data table fields only by encapsulation. how can this be achieved? this is incredible, because traditional tutorials all say that, the database cannot be operated without SQL statements. what is the problem?

Reject posts that Post articles in Baidu. Have your own opinions
------ Solution ----------------------
This is a good implementation
Write a php class to write database operation statements to this class.

And then pass the parameter call. I do not know if it is white.
------ Solution ----------------------
Most php frameworks simulate the implementation of ORM (object relationship Ing, a conceptual and easy-to-understand method for modeling data) to a certain extent, but it is eventually translated into SQL instructions for execution.

------ Solution ----------------------
Of course, the methods in the framework are encapsulated. In the final analysis, it is also necessary to execute SQL.

Function select ($ table, $ field_array ){
$ Field = implode (',', $ field_array );
$ R = mysql_query ("select $ field from $ table ");
Return $ r;
}

The above is a simple example. the perfect writing method should be written as a class. you can find an example on the Internet.

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.