Hi! I've been trying to dump data from a web form (http://prakashfamilyonline.com (the lower form)) and get the script to execute perfectly but the data does not go into the database........ the code is below.. PLEASE HELP! Thanks. Surya
PS: It gives me a "Can't execute SQL statement. Perl says , DBI says " error but doesnt say what error and I'm not able to figure it out.............
#!/perl/bin
require 'cgi-lib2.pl';
use CGI qw(:standard); # Must be used to get the param() functi
+on
use strict;
use OLE;
my $formemail = param("formemail");
my $formpass = param("formpassword");
my $formcpass = param("cformpassword");
my $formfriend = param("formfriendOf");
# This section is for appending the data to the database.
sub new_record {
my $dbh;
$dbh = CreateObject OLE "ADODB.Connection" or die "Can't create connec
+tion to DataBase: $!" unless $dbh;
$dbh->Open("Driver={Microsoft Access Driver (*.mdb)};DBQ=_private/db1.
+mdb");
my $rs = CreateObject OLE "ADODB.Recordset" or die "can not create rec
+ordset";
my $sql;
$sql = "INSERT INTO $formfriend (email,password) VALUES ($formemail,$f
+ormpass)";
$rs = $dbh->Execute( $sql ) or die print ( "Can't execute SQL statemen
+t. Perl says $!, DBI says ",$dbh::errstr,"\n");
}
print &PrintHeader;
print &HtmlTop ("Success!");
new_record();
print "Email: $formemail<br>\n";
print "Password: $formemail<br>\n";
print "Friend Of: $formfriend<br>\n";
print &HtmlBot;
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.