douyi1939 2011-05-25 14:49
浏览 30
已采纳

PHP Parse错误 - 意外$ end [关闭]

I have the following code, and it's giving me a parse error when run. Am I missing something obvious?

http://pastebin.com/FXxEgUB3

Sorry - here's the full error. It says on line 102, but that's after the last tag..

 PHP Parse error:  syntax error, unexpected $end in /var/www/cdr/outgoing_cdr.php on line 102

I see the unclosed bracket, got that, fixed the variable issues, now it's getting much further, but am seeing these errors now:

[Wed May 25 10:14:34 2011] [error] [client 192.168.1.10] PHP Notice:  Array to string conversion in /var/www/cdr/outgoing_cdr.php on line 53
[Wed May 25 10:14:34 2011] [error] [client 192.168.1.10] PHP Warning:  mssql_query() [<a href='function.mssql-query'>function.mssql-query</a>]: message: Could not find stored procedure 'Array'. (severity 16) in /var/www/cdr/outgoing_cdr.php on line 53
[Wed May 25 10:14:34 2011] [error] [client 192.168.1.10] PHP Warning:  mssql_query() [<a href='function.mssql-query'>function.mssql-query</a>]: Query failed in /var/www/cdr/outgoing_cdr.php on line 53
[Wed May 25 10:14:34 2011] [error] [client 192.168.1.10] PHP Warning:  Invalid argument supplied for foreach() in /var/www/cdr/outgoing_cdr.php on line 53
[Wed May 25 10:14:34 2011] [error] [client 192.168.1.10] PHP Notice:  Use of undefined constant salesrep - assumed 'salesrep' in /var/www/cdr/outgoing_cdr.php on line 90
[Wed May 25 10:14:34 2011] [error] [client 192.168.1.10] PHP Notice:  Use of undefined constant repid - assumed 'repid' in /var/www/cdr/outgoing_cdr.php on line 91
[Wed May 25 10:14:34 2011] [error] [client 192.168.1.10] PHP Warning:  mssql_query() [<a href='function.mssql-query'>function.mssql-query</a>]: message: Line 1: Incorrect syntax near ','. (severity 15) in /var/www/cdr/outgoing_cdr.php on line 97
[Wed May 25 10:14:34 2011] [error] [client 192.168.1.10] PHP Warning:  mssql_query() [<a href='function.mssql-query'>function.mssql-query</a>]: Query failed in /var/www/cdr/outgoing_cdr.php on line 97

Line 53 has the foreach statement:

foreach (mssql_query($sqla) as $sqla_res) {
    if (!$sqla_res)
    {
            die('Query (1) failed.');
    } elseif (mssql_fetch_rows($sqla_res)==1)
    {
        $sqlares = $sqla_res;
        $found = mssql_fetch_array($sqla,MSSQL_BOTH);
        $clid = $found[clientid];
    } elseif (mssql_fetch_rows($sqla_res)==0)
    {
        break;
    }
}

Line 97 is running this query:

INSERT INTO $table (extension, phonenumber, calldatetime, callID, name, repID, clientID, subscribed ) VALUES ($extension, $phonenumber, CURRENT_TIMESTAMP, $callID, $name, $repid, $clid, $subs)
  • 写回答

4条回答 默认 最新

  • dongxin8392 2011-05-25 14:52
    关注

    Find $subs = $subs_f[subscribed]; and add a } just after.

    A little tip, change your error_reporting to E_ALL, see how many issues you actually have!

    Foreach Fix:

    $resource = mssql_query($sqla);
    while($row = mssql_fetch_assoc($resource))
    {
         echo $row['column']; //This is an example
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?