duangang4001 2013-04-12 15:27 采纳率: 0%
浏览 63
已采纳

PHP脚本停止在oci_execute

I have a script with the following code to insert data into an Oracle table:

$sql = "INSERT INTO EXAMPLE_TABLE (ID, FIELD, VAL) VALUES (:id, :test, :ok)"; 

$stid = oci_parse($conn, $sql);
//die("parsed ok");

oci_bind_by_name($stid, ":id", $id);
oci_bind_by_name($stid, ":test", $test);
oci_bind_by_name($stid, ":ok", $ok);

//die("params bound");

$result =@oci_execute($stid);

if(!$result)
{               
   $err = oci_error($stid);
   $error = $err['message']; 
   echo $error; die('end error');
}

echo oci_num_rows($stid) . " rows inserted.<br />";
die("inserted");

The script was working fine, and then it just stopped. I threw in some die statements to find where the script is stalling. The last place I can get to is "die("params bound")".

I've verified that the variables are ok and that the database connection is valid. I also manually connected to the database using sqldeveloper and had no problem.

Why is this script suddenly stalling?

  • 写回答

1条回答 默认 最新

  • dpg98445 2013-04-12 15:33
    关注

    As often happens, I had a though immediately after I posted this question. I checked to see how many connections I had open in a GUI, and then closed the connections.

    It turns out that I had some uncommitted changes from some queries that I ran manually in my GUI, and I think that was stalling the script at oci_execute. After rolling back the changes and restarting my connection, the script works fine now.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部