我的代碼資源(3)...odbc_exec()返回假的情況PHP訪問的類型(ODBC結果)
<?php
$parm1 = 8;
//Connect to our MS Access database
$conn=odbc_connect("archive","" ,"password");
//Create our SQL statement
$sql = "SELECT * FROM archive where archiveID = $parm1" . " order by fullname desc";
//Execute our SQL statement
$row=odbc_exec($conn, $sql);
var_dump($row);
echo "<option value=''>Select Local Archive Location</option>";
if ($row !== False) { //if there are records, process them.
while(odbc_fetch_row($row)){ //Iterate through all our records.
echo "<option value='" .trim(odbc_result($row,"archivelocation"))."'>".trim(odbc_result($row,"fullname")).' - '.trim(odbc_result($row,"archivelocation")).' - '.trim(odbc_result($row,"archivedescription"))."</option>";
}
}else{
echo "<option value=''>No data returned for the specified search criteria</option>";
}
odbc_close($conn); //Close our database connection.
?>
當上面的代碼運行,且要返回$的值數據行是類型(odbc結果)的資源(3)。我的理解是正確的。但是,當預計$行爲False值時,我仍然會在False情況下獲得類型(odbc結果)的相同值資源(3)。
有人可以解釋爲什麼這是?
您是否進入'else',所以帶有指定文本的選項被回顯? –
否它似乎並沒有進入else語句 –