|
<?php
$User = "Dana";
$Pass = "123456";
$ODBC = "TEST_DB";
$SQL = "SELECT ACCOUNT, NAME FROM V2_ACCOUNT";
if(!($DBLinkID = odbc_connect($ODBC, $User, $Pass))) {
echo "無法連接ODBC所設定的資料庫!";
exit();
}
$ResultID = odbc_exec($DBLinkID, $SQL);
if (!$ResultID) {
echo "SQL語法有誤!";
odbc_close($DBLinkID);
exit();
}
// 取出資料
$num = 0;
while ($TableRow = odbc_fetch_row($ResultID)) {
echo odbc_result($ResultID, 1);
echo " ";
echo odbc_result($ResultID, 2);
echo "<br>";
}
odbc_close($DBLinkID);
?> |
|