Mysqli错误多次查询

时间:2014-08-13 19:56:56

标签: php mysql mysqli

我需要mysqli错误的帮助:

  

注意:在第718行的C:\ inetpub \ dev \ dashboard \ dashboard_function.php中调用[CALL GetJobBatch(' D14097',' 2.8');]

     

致命错误:在第720行的C:\ inetpub \ dev \ dashboard \ dashboard_function.php中的非对象上调用成员函数fetch_assoc()

我的错误出现在我的第二个查询中

function GetJobWithBatch($no_status, $location){
    global $mysqli;

    $queryJob = "CALL GetJobForBatch('".$no_status."', '".$location."');";
    $ResJob = $mysqli->query($queryJob)or trigger_error($mysqli->error."[$ResJob]");;
    while($row = $ResJob->fetch_assoc()) { 
        $job[] = $row;
    }
    $ResJob->free();
    $mysqli->close();

    foreach($job as $row) { 
        $queryBatch = "CALL GetJobBatch('".$row["JobNumber"]."', '".$no_status."');";
        $batch = $mysqli->query($queryBatch)or trigger_error($mysqli->error."[$queryBatch]");
        var_dump($batch);
        while($batchrow = $batch->fetch_assoc()) { 
            $ArrayBatch[] = $batchrow ;
        }

        $batch->free();
        $mysqli->close();
        foreach($ArrayBatch as $batchrow) { 
        }
}

我试图直接在工作台中执行我的存储过程并且它有效......我不明白我的错误:O

对于那些想要查看我的解决方案的人:

 function GetJobWithBatch($no_status, $location){
    global $mysqli;
    $queryJob = "CALL GetJobForBatch('".$no_status."', '".$location."');";
    $ResJob = $mysqli->query($queryJob)or trigger_error($mysqli->error."[$ResJob]");
    if ($ResJob) {
        while($row = $ResJob->fetch_assoc()) { 
            $job[] = $row;
        }
        $ResJob->close();
        $mysqli->next_result();
    }

    foreach($job as $row) { 
        $queryBatch = "CALL GetJobBatch('".$row["JobNumber"]."', '".$no_status."');";
        $batch = $mysqli->query($queryBatch)or trigger_error($mysqli->error."[$queryBatch]");
        if ($batch) {
            var_dump($batch);
            while($batchrow = $batch->fetch_assoc()) { 
                $ArrayBatch[] = $batchrow ;
            }
            $batch->close();
            $mysqli->next_result();



        foreach($ArrayBatch as $batchrow) { 
        }   


      } 
}

0 个答案:

没有答案