在我的查询中,我需要将我的行的自动增量ID插入另一列。
我需要protonumber列一起有3个字符串,但我无法弄清楚如何检索当前的lastinsertID并让它工作。
有什么想法吗?
$stmt = $db->prepare('INSERT INTO protonumbers (season,program,designer,brand,date,protonumber) VALUES (:season, :program, :designer, :brand, :date, :protonumber)');
$last_id = $pdo->lastInsertId();
$stmt->execute(array(
':season' => $season,
':program' => $program,
':designer' => $designer,
':brand' => $brand,
':date' => $date,
':protonumber' => "{$program}-{$season}-{$last_id}"
));
$id = $db->lastInsertId('protoID');