Hi all...
I'm trying to draw a table count to a static html page via ssi...
can anyone comment on the following code....
it won't work as is....your input would be appreciated.......thanks Rob
#!/usr/bin/perl
@db_connect = ("DBI:mysql:xxxxxx", "xxxxxx", "xxxxxx");
$db_table = 'Items';
$dbh = DBI->connect (@db_connect) or &cgierr ("Connection Error. Reason: " . $DBI::errstr . "\n.");
$query = qq!
SELECT count(*) as num
FROM $db_table
WHERE Validated = "Yes"
!;
$sth = $DBH->prepare ($query) or &cgierr("Unable to query database. Reason: $DBI::errstr. Query: $query");
$sth->execute or &cgierr("Unable to query database. Reason: $DBI::errstr. Query: $query");
$count= $sth->fetchrow_array;
$sth->finish();
$dbh->disconnect();
print "Content-type: text/html\n\n";
print $count;
I'm trying to draw a table count to a static html page via ssi...
can anyone comment on the following code....
it won't work as is....your input would be appreciated.......thanks Rob
#!/usr/bin/perl
@db_connect = ("DBI:mysql:xxxxxx", "xxxxxx", "xxxxxx");
$db_table = 'Items';
$dbh = DBI->connect (@db_connect) or &cgierr ("Connection Error. Reason: " . $DBI::errstr . "\n.");
$query = qq!
SELECT count(*) as num
FROM $db_table
WHERE Validated = "Yes"
!;
$sth = $DBH->prepare ($query) or &cgierr("Unable to query database. Reason: $DBI::errstr. Query: $query");
$sth->execute or &cgierr("Unable to query database. Reason: $DBI::errstr. Query: $query");
$count= $sth->fetchrow_array;
$sth->finish();
$dbh->disconnect();
print "Content-type: text/html\n\n";
print $count;