memo.xight.org

/ / memo.xight.org

2003-11-28

DBD/DBI モジュール と Data-ShowTable

- インストール

# aptitude install libdbd-mysql-perl libdata-showtable-perl

- 使用法

use DBI;
$db  = DBI->connect('DBI:mysql:データベース名:サーバ名', ユーザー名, パスワード);
$sth = $db->prepare("SQL文");
$sth->execute;
$num_rows = $sth->rows;
print "該当 $num_rows 件\n";
for ($i = 0; $i < $num_rows; $i++) {
	@a = $sth->fetchrow_array;
	print "id=$a[0], name=$a[1] memo=$a[2] \n";
}
$sth->finish;
$db->disconnect;

- Reference
@IT - Linux Square - 快速MySQLでデータベースアプリ! - 第4回 PerlでMySQL操作CGIを作ろう
http://www.atmarkit.co.jp/flinux/rensai/mysql04/mysql04a.html
カテゴリ: [Perl]
2003-11 /

Color Reference

ChangeLogを検索
携帯電話からアクセス!

カテゴリ

最近の話題

リンク

過去ログ

Google

QR Code

Since
2002-11-28
Update
2008-02-20 21:23
Copyright © 2005 xight.org All Rights Reserved.