【发布时间】:2015-03-20 08:34:06
【问题描述】:
从this 教程中,我找到了一种获取特定表的最后插入 id 的方法(使用 pdo)。在示例中
$result = $db->exec("INSERT INTO table(firstname, lastname) VAULES('John', 'Doe')");
$insertId = $db->lastInsertId();
他在获取 id 之前进行了查询,我想做这样的事情,但我想在进行任何查询之前先获取他最后插入的条目的 id。How should i tell the code that it should check the last inserted id from this table。任何想法都值得赞赏。
Update
我想获取特定表的last inserted id,而不仅仅是数据库最后插入的id
【问题讨论】: