in reply to Dynamically passing table names to a sql query(DBI)
my $sth = $dbh->prepare( q{SELECT * FROM $table}) || die "Can't prepare statement: $DBI::errstr";
...you have the query single quoted which does not interpolate your $table variable, try this:
my $sth = $dbh->prepare( qq{SELECT * FROM $table}) || die "Can't prepare statement: $DBI::errstr";
...notice the "qq{" which is double quotes and will interpolate $table.
--
hiseldl
What time is it? It's Camel Time!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Dynamically passing table names to a sql query(DBI)
by adrianh (Chancellor) on Oct 09, 2002 at 19:54 UTC | |
|
Re: Re: Dynamically passing table names to a sql query(DBI)
by Anonymous Monk on Oct 09, 2002 at 15:03 UTC |