我设法使Select和Create语句正常工作,但目前在使用PHP的Update语句方面遇到了问题。
countryProcessor.php的结果
Warning: oci_execute(): ORA-00933: SQL command not properly ended in /studenthome.hallam.shu.ac.uk/STUDENTHOME8/8/b4025068/public_html/processor/countryProcessor.php on line 60
CountryID 18
GDP 109
Country Name Australia
Rows Affected 0
CountryProcessor.php
if(isset($_POST['CountryID'])) {
$CountryID = $_POST['CountryID'];
}
if(isset($_POST['CountryName'])) {
$CountryName = $_POST['CountryName'];
}
if(isset($_POST['Gross'])){
$Gross = $_POST['Gross'];
}
$stmt = oci_parse($conn, "UPDATE COUNTRY SET COUNTRYNAME = '$CountryName', GDP = $Gross WHERE COUNTRYID = $CountryID)");
// oci_bind_by_name($stmt, ":CountryID", $CountryID);
// oci_bind_by_name($stmt, ":CountryName", $CountryName);
// oci_bind_by_name($stmt, ":GDP", $Gross);
oci_execute($stmt);
$Affected = oci_num_rows($stmt);
oci_commit($conn);
echo "CountryID" . ' ' . $CountryID . "<br>";
echo "GDP" . ' ' . $Gross . "<br>";
echo "Country Name" . ' ' . $CountryName . "<br>";
echo "Rows Affected" . ' ' . $Affected;
// if(count($Affected) > 0){
// header("Location: ../index.php?Success=$CountryName has been updated!");
// } else {
// header("Location: ../index.php?Danger=$CountryName hasn't been updated!");
// }
oci_free_statement($stmt);
oci_close($conn);