in reply to foolish/simple sql question
Anyway, something like:
Or evenmy $sth = $dbh->prepare(qq{SELECT st8a, st8b FROM sample WHERE id=$id} +); $sth->execute() || die "Error executing query: " . $dbh->errstr . "\n" +; my ($val1,$val2) = $sth->fechrow_array();
Should work.my ($val1,$val2) = $dbh->selectrow_array("SELECT st8a, st8b FROM sampl +e WHERE id=$id");
And you should watch what people can put in the $id variable, either make sure it's number, use $dbh->quote() or use placeholders.
See the DBI docs.
|
|---|