hello, If i am running perl and i want to qury the Msql Database records how do that from perl.
HERE ARE CLUES: DATABASE NAME: DOOM TABLE NAME: T_MAIN RECORDS: VOTE & VOTES RECORD TO QUERY: VOTES PROCEDURE: WHERE A VALUE UNDER VOTES IS GREATER THAN THE REST PROCEDURE: ALSO RETURN THE VOTE CODE WHERE THAT VALUE IS +--------+--------+ | vote | votes | +--------+--------+ | EE | 0 | | GG | 0 | +--------+--------+ HERE IS MY TRY. use DBI; $dsn= "dbi:mysql:db_doom:localhost"; my $user= "mysql"; my $password = "mysql123"; $dbh = DBI->connect($dsn,$user,$password); ##################################GET ARGS ########################## $msg = $ARGV[1]; $source = $ARGV[0]; $msg =~ s/\"/' /ig; $time = localtime(); $msg = $ARGV[1]; $source = $ARGV[0]; $msg =~ s/\"/' /ig; $time = localtime(); open (OUTFILE ,">>C:\\logs\\who.txt"); print OUTFILE "$time\t$source\t$msg\n"; close(OUTFILE); $found = 0; if ($msg =~ /WHO/i) { $found = 1; } if ($found == 1) { $dbh = DBI->connect($dsn,$user,$password); $statement = "select msg from t_main where votes = (this is where Iam stuck) "greater than others" $sth = $dbh->prepare("$statement"); $sth->execute; $message = $sth->fetchrow_array; $sth->finish; print "Thank you, $vote got $vote votes as the highest points.\n"; } else { print "Sorry. check spelling and send again.\n"; } $dbh->disconnect; exit;