PERL How to connect to SQLite database -


i have following html + perl code connecting sqlite database , retrieving value, incrementing it, , updating new value in database. however, code giving internal server error when ran on browser. i'm using apache server. error log tells me check html code there's nothing wrong it. please help:

    <html>                                                                                                    <body>     <form action="/cgi-bin/a.pl"    method="post">         <input type="submit" value="visit"/>     </form>     </body>     </html>       #!c:/perl/bin/perl.exe      use dbi;     use strict;     use cgi;      $cgi = cgi->new();     $driver   = "sqlite";     $database = "my.db";     $dsn = "dbi:$driver:db:$database";     $userid = "";     $password = "";     $dbh = dbi->connect($dsn, $userid, $password) or die $dbi::errstr;      $sth = $dbh->prepare("select cnt visitors");     $rv = $sth->execute() or die $dbi::errstr;     @row = $sth->fetchrow_array();     $nov = $row[0];     $nov++;     $dbh->do('update visitors set nov = ? nov = ?', undef, $nov, $nov-1);     $dbh->disconnect();      print $cgi->header('text/html');     print "no. of visitors = ". $nov . "\n"; 

my error had not create table , not recognize name of table , insert statement failed.


Popular posts from this blog