dongyin8009 2019-03-02 01:30
浏览 99

PHP Oracle更新表错误 - oci_execute ORA-00933

I've managed to get Select and Create statements working but currently got an issue with Update statements using PHP.

Result of 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);
  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 c程序不知道为什么得不到结果
    • ¥40 复杂的限制性的商函数处理
    • ¥15 程序不包含适用于入口点的静态Main方法
    • ¥15 素材场景中光线烘焙后灯光失效
    • ¥15 请教一下各位,为什么我这个没有实现模拟点击
    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置