#!C:/Perl64/bin/perl.exe use strict; use warnings; use DBI; use CGI; my $cgi = new CGI; ##Create table using cgi $dbh = DBI->connect( "dbi:mysql:TestDB", 'root','zulfi12345', { RaiseError => 1, } ) or die "Unable to connect: $DBI::errstr\n"; my $username = $cgi->param( 'username' ) || ''; my $password = $cgi->param ('password') || ''; my $submit = $cgi->param( 'submit' ) || ''; my $sth = $dbh->prepare(" SELECT username, password FROM users WHERE username = ? and password = ? "); my @values = ($username, $password); eval { $sth->execute(@values); }; if($@) { die "Execution of\n" . $sth->{Statement} . "\n" . "with: @values\n" . "failed with: $@\n "; } my $found=0; while(my $row = $sth->fetchrow_hashref) { $found=1; } if ($found==1) { print "Welcome"; }