glcld has asked for the wisdom of the Perl Monks concerning the following question:
I have cgi script using PERL and mysql variables the second sql statement is not working. The $id keeps coming up empty. any help would be appreciated.
my $sql ="select gene_id from gene_product where gene_desc like '%heat +%'"; my $sql1="select * from gene where gene_id = '$id'"; my $rows_ref = $db->sqlexec($sql, '\@@'); my $key_word_json = ''; foreach $row_ref(@$rows_ref){ my $key_word = $row_ref->[0]; $key_word=~s/_G//; print $key_word; push(@keyword, $key_word); } my @results; foreach my $ids(@keyword) { my $id=$ids; print $id; print $sql1; my $rows_ref = $db->sqlexec($sql1, '\@@'); foreach my $row_ref (@$rows_ref){ push(@results, $row_ref); } print $row_ref; } print Dumper(@results);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: MySql statement variable not working
by Eliya (Vicar) on Feb 29, 2012 at 15:50 UTC | |
by glcld (Initiate) on Feb 29, 2012 at 16:46 UTC | |
|
Re: MySql statement variable not working
by locked_user sundialsvc4 (Abbot) on Feb 29, 2012 at 18:52 UTC |