Home > Backend Development > PHP Tutorial > Simple operation of ThinkPHP database access, thinkphp database access_PHP tutorial

Simple operation of ThinkPHP database access, thinkphp database access_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 09:46:56
Original
806 people have browsed it

Simple operation of ThinkPHP database access, thinkphp database access

Comparing traditional sql with sql in ThinkPHP Taking the user table as an example

 

<span>$user</span>=M('user'<span>);
</span>1: SELECT * FROM user----------<span>$user</span>-><span>select();
</span>2: SELECT* FORM user WHERE id=2---------<span>$user</span>->find(2<span>);
</span>3: SELECT username FORMuser-----<span>$user</span>->field('username')-><span>select();<br />4: DELETE FORM username WHEREid=2------$user->delete(2);<br />5: UPDATE user SET username='newUsername' WHERE id=2-------$data['username']='newUsername' $user->save($data);<br />6: INSERT INTO user (name,password)VALUES('php','phpPwd')------$data['name']='php' $data['password']='phpPwd'  $user->add($data);                               </span>
Copy after login

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1029945.htmlTechArticle Simple operation of ThinkPHP database access, thinkphp database access traditional sql and ThinkPHP sql compared with the user table For example $user =M('user' ); 1: SELECT * FROM user---------- $u...
Related labels:
Statement of this Website
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
Latest Issues
Why thinkphp has better performance than laravel?
From 1970-01-01 08:00:00
0
0
0
ThinkPHP Why use composer?
From 1970-01-01 08:00:00
0
0
0
thinkphp versions supported by php6
From 1970-01-01 08:00:00
0
0
0
thinkphp upload files
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template