[plug] Perl/DBI syntax
Nigel Duff
peregrin at iinet.net.au
Tue Sep 9 14:03:20 WST 2003
Hola,
I am trying to connect a cgi script to mysql. Here is what i have;
my $query = $dbh->prepare ("insert into management
(title, item_no, descript, pics, comments, start_date,
end_date, startprice, cost, paid)
values
($fields{TITLE}, $fields{ITEMNO}, $fields{DESCRIPT},
$fields{PICTURES}, $fields{COMMENTS},
$fields{STARTDATE}, $fields{ENDDATE},
$fields{STARTPRICE}, $fields{COST}, $fields{PAIDFOR})");
$query->execute();
print "($fields{TITLE}, $fields{ITEMNO}, $fields{DESCRIPT},
$fields{PICTURES}, $fields{COMMENTS}, $fields{STARTDATE},
$fields{ENDDATE}, $fields{STARTPRICE}, $fields{COST},
$fields{PAIDFOR})";
If I declare the $fields* variables at the start of the script and run
run it from the command line the values are added to the table.
If I call the script from cgi the print line prints the correct values
on the web page but the table doesn't get updated.
Is my mistake glaringly obvious?
Many thanks,
Nigel
More information about the plug
mailing list