[[PHP/PEAR]]
*PEAR::DB [#l9f1db7a]
// 設定
$dbType = 'mysql';
$User = '';
$Pass = '';
$Host = '';
$dbName = '';
include("DB.php");
// DBに接続
$db = DB::connect("$dbType://$User:$Pass@$Host/$dbName");
// SQLを発行
$sql = "select * from sample";
$result = $db->query($sql);
// データを取得
while($row = $result->fetchRow()) {
print_r($row);
}
echo $result->numRows()."件\n"
// DB切断
$db->disconnect();
*参照 [#a969c600]
-http://www.php-j.com/
-http://www.php-j.com/tutorial/php/pearDB.php