时间:2021-07-01 10:21:17 帮助过:25人阅读
$user=M('user'); 1: SELECT * FROM user----------$user->select(); 2: SELECT* FORM user WHERE id=2---------$user->find(2); 3: SELECT username FORMuser-----$user->field('username')->select();
4: DELETE FORM username WHEREid=2------$user->delete(2);
5: UPDATE user SET username='newUsername' WHERE id=2-------$data['username']='newUsername' $user->save($data);
6: INSERT INTO user (name,password)VALUES('php','phpPwd')------$data['name']='php' $data['password']='phpPwd' $user->add($data);
以上就介绍了ThinkPHP的数据库访问的简单操作,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。