MySQL get Primary Key after Insert Statment
问题 I need to use the following insert statement, and the primary key field is auto increment. I need to return the new primary key value after the insert. Preferably using one statement to do the insert and return primary key value. $query = $database->connection->prepare("INSERT INTO accounts (created, priviledge, password, token, idle) VALUE ('$created', '1', :password, '$token_encrypt', '$idle')"); $query->bindParam(":password", $password_hash); $query->execute(); 回答1: As soon as you're using