How does thinkphp write traditional SQL statements in the Model?

Source: Internet
Author: User
How does thinkphp write traditional SQL statements in the Model? For example, I want to write $ insertsql & nbsp ;=& nbsp; "INSERT & nbsp; INTO & nbsp; wordtest (english, chinese, addedtime, user_id, phptime) & how does nb thinkphp write traditional SQL statements in the Model?
For example, if you want to write
$ Insertsql = "insert into wordtest (english, chinese, addedtime, user_id, phptime) VALUES ('". $ singleword. "','". $ collectchinese. "', NOW (),'". $ userid. "','". $ phptime. "')"; // = the user ID found, added to the user_id field in the word table;
$ Sqlobj-> query ($ insertsql );
I don't want to use the D (); or M () method to directly write a class in the Model.
Can I perform this operation? How do I perform this operation?
------ Solution --------------------
The use of the framework also requires a certain price.

Although the ORM mode in the current framework is very inefficient, it does not mean that it will not become a real ORM in the future.
Of course, the ORM in the current framework is executed after it is assembled into an SQL string.

Therefore, the framework also provides the ActiveRecord mode for you to directly use the SQL command string
$ Model = new Model () // instantiate a model object without any data tables
$ Model-> query ("select * from think_user where status = 1 ");

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.