2013-07-27 119 views
0

下面我試圖用以下四個參數調用存儲過程。但是,我沒有收到任何錯誤,結果也沒有產生任何記錄。我在填充1條記錄的DB中運行查詢。有任何想法嗎?檢索存儲過程

<?php 
//// GET CONNECTIONS 
include('../Connect/con.php'); 
if(!$conn){ 
    echo 'Connection failed.';  
} 

if ($conn){ 

    $sql = "{call up_lkpAddressSearch} @State=N'FL', @county=N'BROWARD', @HouseNbr=N'3117', @StreetName=N'COCOPLUM'"; 
    $query_address = sqlsrv_query($conn, $sql); 

    if($query_address === false) 
    { 
     echo "Error in statement preparation/execution.\n"; 
     die(print_r(sqlsrv_errors(), true)); 
    } 

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

    /* Make the first row of the result set available for reading. */ 
    if(sqlsrv_fetch($query_address) === false) 
    { 
     echo "Error in retrieving row.\n"; 
     die(print_r(sqlsrv_errors(), true)); 
    } 


    while($row = sqlsrv_fetch_array($query_address, SQLSRV_FETCH_ASSOC)) { 
      $id = $row['SA_PROPERTY_ID']; 
      echo $id; 
    } 
} 
// END CONNECTION TEST 
sqlsrv_close($query_address); 
?> 

我繼續嘗試併產生一個記錄,我能夠呼應出

$id = sqlsrv_get_field($query_addressSearch, 0); 
echo $id .'<br />'; 

然而,while循環不產生記錄。

問候 喬希

回答