缺少语法错误

时间:2017-06-30 06:54:48

标签: php arrays sql-server

我需要开发一个php代码来创建一个双级数组。当我运行该文件时,会出现此错误:

  

解析错误:语法错误,意外&#39 ;;'在   第20行的C:\ inetpub \ wwwroot \ file.php

我认为我的错误是一个错字或一些句子坏关闭但我无法找到它。

<?php
$serverName = "serverName\SQLEXPRESS";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"user", "PWD"=>"pass");
$conn = sqlsrv_connect( $serverName, $connectionInfo);


if( $conn === false ) {                                  
    die( print_r( sqlsrv_errors(), true));
}

$sql = "SELECT * FROM table1";
$stmt = sqlsrv_query( $conn, $sql);
if ($stmt === false) {
    die( print_r( sqlsrv_errors(), true) );
}

$bbs = array();
while($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_NUMERIC){
    $bbs = array_merge($bbs, array_values($row));
}

print_r($bbs);

?>

3 个答案:

答案 0 :(得分:1)

您忘记关闭第20行中的<?php $serverName = "serverName\SQLEXPRESS"; $connectionInfo = array( "Database"=>"dbName", "UID"=>"user", "PWD"=>"pass"); $conn = sqlsrv_connect($serverName, $connectionInfo); if ($conn === false) { die(print_r(sqlsrv_errors(), true)); } $sql = "SELECT * FROM table1"; $stmt = sqlsrv_query($conn, $sql); if ($stmt === false) { die(print_r(sqlsrv_errors(), true)); } $bbs = array(); while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_NUMERIC)) { $bbs = array_merge($bbs, array_values($row)); } print_r($bbs);

List<Car> cars = db.Car.Where(x => x.ProductionYear == 2005).ToList();

答案 1 :(得分:0)

public static final int PORT = 8080
def baseUrl = 'http://localhost:8080/**************************'
@Rule
 WireMockRule wireMockRule = new WireMockRule(PORT)
 private final static Logger log = Logger.getLogger( "PingRequest" )

 @Test
void testPingRequest() {
    given:       
        def http = new HTTPBuilder(baseUrl)
        def headers = ['Accept': 'application/xml', 'Content-Type': 'application/xml']
        def requestBody = '{}'

        http.handler.failure = http.handler.success

        when:
            def response = http.post(contentType: ContentType.XML, headers: headers, body: requestBody)

        then:
            wireMock.verifyThat(new RequestPatternBuilder(RequestMethod.GET, urlPathEqualTo("********************************")))
            response
            !response.errors
}

您缺少一个紧密的括号,您有两个(但只有一个)

答案 2 :(得分:0)

age_cont$Count[i] %in% 3

你错过最后的括号,关闭时间