php - PHP Oracle 更新表错误 - oci_execute ORA-00933
问题描述
我已经设法让 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);
解决方案
推荐阅读
- kotlin - 在 Kotlin 中将一对列表展平为列表的惯用方法
- python - 如何制作一个python程序来重复执行几个任务相同的次数但每个任务都有独立的时间间隔?
- python - 您如何检查特定用户是否对带有许多特定表情符号的特定消息做出反应
- rust - 如何设置响应的状态码?
- sparql - 针对特定 RDF 格式的 SPARQL 查询
- laravel - Laravel7 - 检测到节流时重定向特定视图
- c# - 如何传递列表以根据加班时间查看和过滤它们。fx 显示所有员工,然后在 asp.net core mvc 中过滤员工
- ruby-on-rails - 红宝石更新的问题
- vue.js - 如何在Vue中根据当前时间显示活动步骤?
- javascript - 使用 .map 循环对象数组并将新数组存储在对象值中