-1

我正在尝试更新患者的记录,它说它完整但它没有更新 phpmyadmin。当我按下保存和更新按钮时,它显示保存成功。有任何想法吗 ?


<?php
include 'connect.php';

$id1 = $_POST['PatientID']; //Text box the user searches in

mysql_query("UPDATE PatientRecords SET 
PatientID = '".$_POST['PatientID']."', 
FirstName = '".$_POST['FirstName']."', 
LastName = '".$_POST['LastName']."',
DOB = '".$_POST['DOB']."', 
IDNumber1 = '".$_POST['IDNumber1']."', 
Medication1 = '".$_POST['Medication1']."', 
Medication1Dosage = '".$_POST['Medication1Dosage']."',
IDNumber2 = '".$_POST['IDNumber2']."', 
Medication2 = '".$_POST['Medication2']."', 
Medication2Dosage = '".$_POST['Medication2Dosage']."', 
IDNumber3 = '".$_POST['IDNumber3']."', 
Medication3 = '".$_POST['Medication3']."', 
Medication3Dosage = '".$_POST['Medication3Dosage']."', 
MedicalNotes = '".$_POST['MedicalNotes']."'
WHERE PatientID = '$id1');

echo"Patient Information has been updated successfully";
mysql_close($con);
?>
4

1 回答 1

1

您的查询一开始就是错误的。如果您要更新现有的行,请忽略该VALUES (...行并在WHERE PatientID = '$id1'. 如果您要插入新行,请使用INSERT table (column, column, ...) VALUES (value, value, ...)并且不要使用 WHERE。

于 2013-05-07T16:14:43.050 回答