以下は、mysqlデータベースに接続し、perlを使用して結果を取得するためのコードです。
次の例では、サンプルテーブルに10列あります。レコード99の2番目と3番目の列を変数に入れたいだけです。
誰かがこれで私を助けることができますか?
use strict;
use warnings;
use DBI;
my $dbh = DBI->connect('dbi:mysql:perltest','root','password') or die "Connection Error: $DBI::errstr\n";
my $sql = "select * from samples where record='99'";
my $sth = $dbh->prepare($sql);
$sth->execute or die "SQL Error: $DBI::errstr\n";
while (my @row = $sth->fetchrow_array) {
print "@row\n";
}
前もって感謝します