Hi I'm trying to enter values into a mysql databse from my webserver.My problem is that from the web server i can enter a value into the database, it tells you the value has been entered but when i check the databse it is not there. This is my code
#!/usr/bin/perl
use CGI qw
standard);
use CGI::Carp qw(fatalsToBrowser);
use DBI;
my $username = 'root';
#my $password = '';
my $dbh = DBI->connect("DBI:mysql:spamdb",$username) || die "Error connecting: '$DBI::errstr'";
my $address = param('email');
my $subject = param('subject');
my $sql = "INSERT INTO addsubj (address,subject) VALUES ($address,$subject)";
my $sth = $dbh->prepare($sql) || die "Error preparing: DBI:errstr";
$sth->execute;
print header;
print qq(<h1> Values Entered</h1>);
print qq(<br> Email address : $address <br>);
print qq(<br> Email subject : $subject<br>);
end_html();
$dbh->disconnect;
Does anybody know where i am going wrong?? Thank you..
#!/usr/bin/perl
use CGI qw
use CGI::Carp qw(fatalsToBrowser);
use DBI;
my $username = 'root';
#my $password = '';
my $dbh = DBI->connect("DBI:mysql:spamdb",$username) || die "Error connecting: '$DBI::errstr'";
my $address = param('email');
my $subject = param('subject');
my $sql = "INSERT INTO addsubj (address,subject) VALUES ($address,$subject)";
my $sth = $dbh->prepare($sql) || die "Error preparing: DBI:errstr";
$sth->execute;
print header;
print qq(<h1> Values Entered</h1>);
print qq(<br> Email address : $address <br>);
print qq(<br> Email subject : $subject<br>);
end_html();
$dbh->disconnect;
Does anybody know where i am going wrong?? Thank you..