Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP分析错误-意外的$end_Php_Sql_Sql Server_Parsing - Fatal编程技术网

PHP分析错误-意外的$end

PHP分析错误-意外的$end,php,sql,sql-server,parsing,Php,Sql,Sql Server,Parsing,我有下面的代码,它在运行时给了我一个解析错误。我错过了什么明显的东西吗 抱歉-这是全部错误。第102行写着,但在最后一个标签后面 PHP Parse error: syntax error, unexpected $end in /var/www/cdr/outgoing_cdr.php on line 102 我看到了未闭合的括号,明白了,修复了变量问题,现在它变得更进一步了,但我现在看到了这些错误: [Wed May 25 10:14:34 2011] [error] [clien

我有下面的代码,它在运行时给了我一个解析错误。我错过了什么明显的东西吗

抱歉-这是全部错误。第102行写着,但在最后一个标签后面

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

我看到了未闭合的括号,明白了,修复了变量问题,现在它变得更进一步了,但我现在看到了这些错误:

[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
第97行正在运行此查询:

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

查找
$subs=$subs_f[subscribed]
并在后面添加一个
}

一个小提示,将您的错误报告更改为
E\u ALL
,看看您实际遇到了多少问题

Foreach Fix:

$resource = mssql_query($sqla);
while($row = mssql_fetch_assoc($resource))
{
     echo $row['column']; //This is an example
}

第二个else块没有闭合曲括号。

在第79行之后闭合打开的括号。

我注意到两个问题:

  • else
    从第77行开始没有右括号
    }
    (错误原因)
  • 在线#99而不是
    if(!$sql)
    您可能想要
    if(!$result)

我认为您忘记了第77行else语句的结束括号,您在哪一行获得它???请参见第2行-错误报告(E_ALL);:)所以你会得到错误吗?比如常数未定义订阅假设“subscribed”@RobertPitt-不,请参见上面的新错误。我不会为你修复代码,但我会说,当你访问一个数组并寻找一个strnig索引时,你应该用单引号括起来,所以
$array['index']
告诉php你用字符串搜索!谢谢,这很有道理。不过,我把foreach()怎么了?谢谢,这两个都有。也称为$cidname;应该是$phonenumber.Closed,现在看到新的、不相关的错误。有什么想法吗?
$resource = mssql_query($sqla);
while($row = mssql_fetch_assoc($resource))
{
     echo $row['column']; //This is an example
}
} else {
        $sql_subs = "SELECT subscribed FROM $tbl_mkt WHERE clientid = $clid";
        $subs_res = mssql_query($sql_subs);
        if (!$subs_res) {
            die('Query (2) failed.');
        } else {
                $subs_f = mssql_fetch_array($sqla,MSSQL_BOTH);
                $subs = $subs_f[subscribed];
}