Есть ли способ создать строку, которая заменит старую запись новой? Или есть способ, которым при создании новой записи старая запись удаляется?
В настоящее время веб-сайт будет классифицировать два номера rosterID как «старые» и «новые». p>
Спасибо!
Фрагмент проблемного кода:
Код: Выделить всё
// If there's a double entry, throw a submission error and don't add this entry to sql table
if(sqlsrv_num_rows($stmtGet) > 0) {
// If recertification box is checked, add new record as 'current' and update previous record as 'old'
if (isset($_GET['recertify'])) {
if ($Station != "" and $Trainee_Name != "" and $Trainer_Name != "" and $date != "") {
$updatesql = "UPDATE $certifications SET $certifications.[Recertification] = '$updateCert'
WHERE $certifications.[Roster ID] = '$rosterID' AND $certifications.[Station] = '$Station' AND $certifications.[Recertification] = '$Recert'";
$sql = "INSERT INTO $certifications ([Roster ID], Station, Trainer_Name, Date, Recertification) VALUES
('$rosterID', '$Station', '$Trainer_Name', '$date', '$Recert')";
if(sqlsrv_query($conn, $updatesql) AND sqlsrv_query($conn, $sql)){
?>
has successfully been recertified at .
Подробнее здесь: [url]https://stackoverflow.com/questions/78673974/how-to-modify-php-code-to-replace-existing-sql-entry-instead-of-creating-duplica[/url]
Мобильная версия