- Impact
- 0
I have done some simple postgre database work in perl on a local machine and now I want to do an online database. I have set up the postgre db with several tables and I am able to execute SQL commands from phpPgadmin but I am trouble getting perl scripts to "execute". My script is connecting to db, It fails as at "$sth->execute;" Could it be a user privlege issue? Any help would be apreciated. My code..
use DBI;
my $dbh = DBI->connect('dbi: Pg:dbname=db_name;host=localhost', 'user', 'pass');
$sth = $dbh->prepare("SELECT * FROM users");
$sth->execute; # this is where it fails #
while ( @row = $sth->fetchrow()){
$ct++;
}
print "ct = $ct";
exit;
I am trying to at least get a hit by counting a how many times it loops through the array.
Any help to this newbee would be great!!
use DBI;
my $dbh = DBI->connect('dbi: Pg:dbname=db_name;host=localhost', 'user', 'pass');
$sth = $dbh->prepare("SELECT * FROM users");
$sth->execute; # this is where it fails #
while ( @row = $sth->fetchrow()){
$ct++;
}
print "ct = $ct";
exit;
I am trying to at least get a hit by counting a how many times it loops through the array.
Any help to this newbee would be great!!







