Home > Backend Development > PHP Tutorial > thinkphp写入一条数据,同时取得这条数据的ID

thinkphp写入一条数据,同时取得这条数据的ID

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-23 14:24:34
Original
1302 people have browsed it

thinkphp 取得id

thinkphp写入一条数据,同时取得这条数据的ID,怎么做?做的话一般都是根据ID查询,或者模糊查询。怎样取得写入的那条数据的id? 

回复讨论(解决方案)

一般来说mysql是支持获取上一次insert的id的,使用函数mysqli_insert_id,你看看thinkphp中有类似的封装么?

http://www.php.net/manual/en/mysqli.insert-id.php

lastInsID 属性

source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template