Another error is that you don't convert your parameters from text to SQL. That could be done through
$db->quote or through replaceable parameters.
sub dbQuery{
my $query = shift @_;
my($database) = "myDB";
my($username) = "username";
my($password) = "password";
my($hostname) = "myHost.com";
my $db = dbConnect($database, $username, $password, $hostname);
$query = $db->prepare($query);
$query->execute(@_);
$query->finish;
dbDisconnect($db);
}
my $gi = "11111111"
my $orgName = "some bacteria"
my $nc = "NC_000000"
my $query = "INSERT INTO ORGANISM ORG_NAME, GI, NC VALUES (?, ?, ?)";
dbQuery($query, $gi, $orgName, $nc);
That will fix a problem unrelated to the one you're asking about.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.