PDO - get current inserted ID

后端 未结 3 1701
礼貌的吻别
礼貌的吻别 2021-01-12 08:45
$query = \"INSERT INTO news VALUES (NULL, :param1 , :param2  )\";
$stmt = $pdo->prepare($query);

$params = array(
    \"param1\" => $p[\'title\'],
    \"param         


        
3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-12 09:24

    You could use PDO::lastInsertId

    $last_insert_id = $pdo->lastInsertId();
    

提交回复
热议问题