1
    foreach ($record_sets as $row) {
        $params->Loginname = "a";
        $params->Password = "xxxxxxx";
        $params->studentresult = "<a1><marks>95</marks><grade>A</grade></a1>"; 
        $params->rollid = $row[0];

        $response = $client->Marksofstudent($params);
        $result = $response->Marksresult->SqlXml->any;

        var_dump($result);    

        if (strpos($result, 'error') === false) {
        /* do nothing */
    }  else {
        $array = array(
                    "marks" => $row[0],
                    "Subject"  => $row[1]
                 );
    ?> 
    <script>
    message = 'failure to post for ' + <?php echo $array->$row[0]; ?> + 'reportid and ' + '<?php echo $array->row[1]; ?>' +  'certificatenumber';
    adiha_CreateMessageBox('alert', message);
    </script>
<?php } } ?>
    }

我想在执行 foreach 循环后提示消息并捕获所有 $row[0] 和 $row[1] 值并警告消息“无法 $row[0] 和 $row[1] 组合更新”。目前在上面的代码中,我无法获得 $row[0] 和 $row[1] 的值。

我想要一条消息,例如“无法上传标记 1 主题 x 标记 2 主题 y”。

4

1 回答 1

0

I have no idea what you are doing but if you want to use the data you are adding to the array you have to change your code:

else {
    $array = array(
        "marks" => $row[0],
        "Subject"  => $row[1]
    );
?> 
<script>
    message = 'failure to post for ' + <?php echo $array['marks']; ?> + 'reportid and ' + '<?php echo $array['Subject']; ?>' +  'certificatenumber';
    adiha_CreateMessageBox('alert', message);
</script>

Or use $row[0] and $row[1] instead if you do not use the array otherwise in your code.

于 2013-09-04T17:59:21.673 回答