in reply to Re: Persistent database connections show incorrect results
in thread Persistent database connections show incorrect results
use strict vars; use CGI qw(param); use diagnostics ; # Constants my $db = "ecreditdb"; my $server = "localhost"; my $user = "updater"; my $password = "1q2w3e4r"; # CGI Parameters my $Id = param("ID"); my $Fname = param("Fname"); sub init { # Connect to database my $dbh = ''; $dbh = DBI->connect("DBI:mysql:$db:$server", $user,$password); if (! $dbh) { print "Could not connect to $db on $server\n"; } $dbh->{RaiseError} = 1; # Prepare and run the query my $query="INSERT INTO clients values( \"$Fname\",\"$Id\") ;"; my $sth = $dbh->prepare_cached("$query") or die "Can't prepare stateme +nt: $dbh->errstr \n"; $sth->execute or die "Can't execute statement", $dbh->errstr ; $sth->finish; $dbh->disconnect(); disp(); } # End sub disp { print " <html> <head> <title>Update completed successfully</title> </head> <body bgcolor=\"#CCCCCC\"> <p align=\"center\"><font face=\"Courier New\" size=\"4\"><b><br> <font color=\"#000000\">Update completed successfully</font></b></font +></p> <p align=\"center\"> </p> <p align=\"center\"> <b><font color=\"#8000000\">Please logon again !! </font></b></p> <p align=\"center\"> </p> <p align=\"center\"> <a href=\"/private/login.htm\">Press here to logon</a></p> </body> </html> "; } init();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Persistent database connections show incorrect results
by perrin (Chancellor) on Apr 17, 2002 at 20:34 UTC | |
by PB (Initiate) on Apr 17, 2002 at 21:25 UTC |