apocalyptica has asked for the wisdom of the Perl Monks concerning the following question:
st8a: 22 st8b: 2
My question now is, and this is embarassing -- how do I, you know, get that data that the SQL command is bringin up and put it into variables that I can use? Am I even doing all of this properly? Thanks, you guys are the best.#! /usr/bin/perl use strict; use DBI; die "Usage: status <id> [<id> ...]\n" unless $#ARGV >= 0; my $id = @ARGV[0]; my $dbh = DBI->connect("dbi:Pg:dbname=eppie;host=localhost;port=5432") || die "Error connecting to database: $DBI::errstr\n"; my $sth = $dbh->prepare(qq{ SELECT st8a, st8b FROM sample WHERE id=$id}); $sth->execute() || die "Error executing query: " . $dbh->errstr . "\n"; $sth->finish(); $dbh->disconnect();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: foolish/simple sql question
by eric256 (Parson) on Jun 01, 2004 at 19:18 UTC | |
|
Re: foolish/simple sql question
by Joost (Canon) on Jun 01, 2004 at 19:24 UTC |