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 statement: $dbh->errstr \n"; $sth->execute or die "Can't execute statement", $dbh->errstr ; $sth->finish; $dbh->disconnect(); disp(); } # End sub disp { print " Update completed successfully


Update completed successfully

 

Please logon again !!

 

Press here to logon

"; } init();