-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [EMAIL PROTECTED] wrote: > my $query = qq|SELECT SUM(MINS) FROM files WHERE USER='$user'|; > my $do = $dbh->do($query); > print "$do"; > > Where MINS is integar, Now when I print $do it obviously prints only '1', > marking return of the query. 1 means 1 row returned.
> How I am supposed to print the same results here in script instead of '1' > only. Under the perldoc for DBI: It [do] should not be used for SELECT statements because it does not return a statement handle (so you can't fetch any data). my $query = qq|SELECT SUM(MINS) FROM files WHERE USER=?|; my $sth = $dbh->prepare($query) or die $dbh->errstr; $sth->execute($user) or die $dbh->errstr; my @row = $sth->fetchrow_array; print @row; That should probably do it- note the use of the placeholder (DBI will automatically escape $user properly for you. Hope this helps, Ricky -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQFGhnjqZBKKLMyvSE4RApdEAKCclJOcmZVmtEko3YaSzpy/stB5DQCgh54+ Q2Y/aJgsU2b3CATEeNSo/P8= =LSa4 -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/