Ive got this following cgi code and it dont wanna seem to work, it inserts a blank record into the MySQL database, the ID field is an auto number field
my $dbh = DBI->connect($dsn, $username, $password);
my $sql_appendstatement = "INSERT INTO `TournamentDates` (`ID`, `Course`, `CourseLoc`, `CompType`, `CompDay`, `CompDate`, `TeeOff`, `Finished`, `Order`) VALUES ('', '$FORM{Coursenew}', '$FORM{Locationnew}', '$FORM{Typenew}', '$FORM{Daynew}', '$FORM{Datenew}', '$FORM{TeeOffnew}', '0', '$FORM{Ordernew}')";
my $sth = $dbh->prepare($sql_appendstatement) || die "Could not prepare: " . $dbh->errstr();
$sth->execute() || die "Could not execute: " . $dbh->errstr();
$sth->finish();
$dbh->disconnect();
All the $FORM{*} values contain values cause ive put a print statement after it runs the sql statement with the value of the sql string and it printed out.
INSERT INTO `TournamentDates` (`ID`, `Course`, `CourseLoc`, `CompType`, `CompDay`, `CompDate`, `TeeOff`, `Finished`, `Order`) VALUES ('', '5555555', '5576g7657657', '5g7765765', '76yf', '5765757567', 'fhfgfg', '0', '1')
Whats wrong with that?? why wont it work right? ive copy and pasted the above sql string into myphpadmin and executed it and it appends the record fine, but it wont append it from my script. well it appends it but its blank. ??
my $dbh = DBI->connect($dsn, $username, $password);
my $sql_appendstatement = "INSERT INTO `TournamentDates` (`ID`, `Course`, `CourseLoc`, `CompType`, `CompDay`, `CompDate`, `TeeOff`, `Finished`, `Order`) VALUES ('', '$FORM{Coursenew}', '$FORM{Locationnew}', '$FORM{Typenew}', '$FORM{Daynew}', '$FORM{Datenew}', '$FORM{TeeOffnew}', '0', '$FORM{Ordernew}')";
my $sth = $dbh->prepare($sql_appendstatement) || die "Could not prepare: " . $dbh->errstr();
$sth->execute() || die "Could not execute: " . $dbh->errstr();
$sth->finish();
$dbh->disconnect();
All the $FORM{*} values contain values cause ive put a print statement after it runs the sql statement with the value of the sql string and it printed out.
INSERT INTO `TournamentDates` (`ID`, `Course`, `CourseLoc`, `CompType`, `CompDay`, `CompDate`, `TeeOff`, `Finished`, `Order`) VALUES ('', '5555555', '5576g7657657', '5g7765765', '76yf', '5765757567', 'fhfgfg', '0', '1')
Whats wrong with that?? why wont it work right? ive copy and pasted the above sql string into myphpadmin and executed it and it appends the record fine, but it wont append it from my script. well it appends it but its blank. ??