donglian1384 2015-12-02 19:53
浏览 123

MySQL打开游标导致错误“POST myphp.php net :: ERR_CONNECTION_RESET”

I have a stored procedure in MySQL that is run from a PHP file. All is well so long as I comment out all cursor handling in the stored procedure (apart from the declarations).

If, however I leave so much as open myCursor; running (with or without close myCursor;) I get the error 'POST myphp.php net::ERR_CONNECTION_RESET'.

The definition of the cursor makes no difference. I've tried changing the cursor's select to something really simple that definitely runs.

Despite the error the processing done using the cursor works and the stored procedure continues logging its progress right to the end. It's only when it gets back to the PHP that it all falls to pieces for no apparent reason.

The only possibility that I can see is that the cursor corrupts the results, maybe by producing some warning message, but if so I don't know which message or how to deal with it and there's no obvious reason for an error message, particularly as I don't have to run so much as a single Fetch on a cursor to produce the problem.

Here's how the stored procedure is run:

if ($stmt2 = mysqli_prepare($con, "call mySP(?)")) {#Store statement
   mysqli_stmt_bind_param($stmt2, 's', $par);
   mysqli_stmt_execute($stmt2);
   $result = mysqli_stmt_get_result($stmt2);

mysqli_stmt_execute($stmt2); is the last line that I can say for sure runs. Nothing in the rest of the PHP runs after $result = mysqli_stmt_get_result($stmt2);.

Note that if after mysqli_stmt_execute($stmt2); I output mysqli_stmt_errno($stmt2).','.mysqli_stmt_error($stmt2) I get '0,' so it looks like there's no error being thrown by mysqli_stmt_execute($stmt2);

For completeness here's an excerpt from the javascript that's used to call the PHP:

$.ajax({
            type : "POST",
            url : "./php/myphp.php",
            cache : false,
            data : {
                sheet : JSON.stringify(userJson)
            },
            datatype : "json"
        }).done(function(result) {

Please help as I'm tearing my hair out over this and I can find no way to debug it or work around it.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 高德地图点聚合中Marker的位置无法实时更新
    • ¥15 DIFY API Endpoint 问题。
    • ¥20 sub地址DHCP问题
    • ¥15 delta降尺度计算的一些细节,有偿
    • ¥15 Arduino红外遥控代码有问题
    • ¥15 数值计算离散正交多项式
    • ¥30 数值计算均差系数编程
    • ¥15 redis-full-check比较 两个集群的数据出错
    • ¥15 Matlab编程问题
    • ¥15 训练的多模态特征融合模型准确度很低怎么办