Home  >  Article  >  Backend Development  >  Newbie, please ask about thinkphp executing sql problem

Newbie, please ask about thinkphp executing sql problem

WBOY
WBOYOriginal
2016-08-18 09:15:44982browse

Thinkphp framework wants to execute its own native sql, how to set up the execution! I'm new to this, thank you

Reply content:

Thinkphp framework wants to execute its own native sql, how to set up the execution! I'm new to this, thank you

To execute the native sql written by yourself, you can instantiate it directly using query() or execute(). Note that generally execute() is used for inserting and updating. Examples are as follows

<code>$model = new \Think\Model();

$model->query("SELECT ......"); //查询

$model->execute("INSERT ....."); //插入

$model->execute("UPDATE ....."); //更新</code>

Read more manuals and refer to the manual

Agree with the first floor, query and execute execute sql in thinkphp

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn