close
例1 計算列數
<?php
$dbh = new PDO('odbc:sample', 'db2inst1', 'ibmdb2');
$sth = $dbh->prepare("SELECT name, colour FROM fruit");
/* 計算一個(不存在)的結果集中的列數 */
$colcount = $sth->columnCount();
print("Before execute(), result set has $colcount columns (should be 0)\n");
$sth->execute();
/* 計算結果集中的列數 */
$colcount = $sth->columnCount();
print("After execute(), result set has $colcount columns (should be 2)\n");
?>
以上例程會輸出:
Before execute(), result set has 0 columns (should be 0)
After execute(), result set has 2 columns (should be 2)
全站熱搜