Maybe I'm way off course here, but it looks like your SQL statement is
wrong. The column names and values appear to be around the wrong way (.
Perhaps you should rewrite it with placeholders - something like:
$sth = $db->prepare(qq{
INSERT INTO tickets (remedy_ticket_number, date_received,
customer_name, customer_phone, customer_email, status)
values (?,?,?,?,?,?)
});
$sth->execute($remedy_number, $date_received, $customer_name,
$phone_number, $email_address, 'O');
It also seems that you have more values than columns in the insert. Plus if
you checked for error messages, you probably find that the "insert"
preparation has failed:
$sth = $db->prepare($sql) || die DBI::errstr;
Dan
-----Original Message-----
From: news [mailto:suppressed On Behalf Of Robert
Sent: Saturday, 14 August 2004 1:41 a.m.
To: suppressed
Subject: [cgiapp] I have a problem with "form"
my form code:
<form name="frm" action="index.pl" method="post">
<input type="hidden" name="rm" value="insert">
<table summary="holds the input ticket form">
<tr>
<td class="rtAlign">Remedy#:</td>
<td><input type="text" name="remedy_ticket" value="<TMPL_VAR
NAME=REMEDY_TICKET>" /></td>
</tr>
<tr>
<td class="rtAlign">Received:</td>
<td><input type="text" name="date_received" value="<TMPL_VAR
NAME=DATE_RECEIVED>" /> format: 08-JUN-04</td>
</tr>
<tr>
<td class="rtAlign">Customer:</td>
<td><input type="text" name="customer_name" value="<TMPL_VAR
NAME=CUSTOMER_NAME>" /></td>
</tr>
<tr>
<td class="rtAlign">Phone#:</td>
<td><input type="text" name="phone_number" value="<TMPL_VAR
NAME=PHONE_NUMBER>" /> format: 305-292-8814</td>
</tr>
<tr>
<td class="rtAlign">Email:</td>
<td><input type="text" "email_address" value="<TMPL_VAR
NAME=EMAIL_ADDRESS>" /></td>
</tr>
<tr>
<td> </td>
<td><button type="submit" value="Submit
Form">Submit</button> <button type="reset">Reset</button></td>
</tr>
</table>
</form>
My C-A code:
sub insert_ticket {
my $self = shift;
my $q = $self->query();
# form information
my $remedy_number = $q->param('REMEDY_NUMBER');
my $date_received = $q->param('DATE_RECEIVED');
my $customer_name = $q->param('CUSTOMER_NAME');
my $phone_number = $q->param('PHONE_NUMBER');
my $email_address = $q->param('EMAIL_ADDRESS');
my $db = DBI->connect(
'dbi:Oracle:host=lims-pro2;sid=LIMSRPT',
'rpts',
'rpts',
{PrintError => 0, RaiseError => 1, AutoCommit => 1,},
) || die "Database connection not made: $DBI::errstr";
$sth = $db->prepare(qq{
INSERT INTO tickets ($remedy_number, $date_received, $customer_name,
$phone_number, $email_address, 'O')
VALUES (remedy_ticket_number, date_received, NULL, customer_name,
customer_phone, customer_email, status)
});
$sth->execute();
# close the connection
$db->disconnect();
# go to the main page
$self->run_mode('main');
}
The Apache error:
[Fri Aug 13 09:38:55 2004] [error] [client 10.149.69.114] Premature end of
script headers: c:/apache/htdocs/ellipse/index.pl [Fri Aug 13 09:38:55 2004]
[error] [client 10.149.69.114] Use of uninitialized value in concatenation
(.) or string at EllipseApp.pm line 121.\n [Fri Aug 13 09:38:55 2004]
[error] [client 10.149.69.114] Use of uninitialized value in concatenation
(.) or string at EllipseApp.pm line 121.\n [Fri Aug 13 09:38:55 2004]
[error] [client 10.149.69.114] Use of uninitialized value in concatenation
(.) or string at EllipseApp.pm line 121.\n [Fri Aug 13 09:38:55 2004]
[error] [client 10.149.69.114] Use of uninitialized value in concatenation
(.) or string at EllipseApp.pm line 121.\n [Fri Aug 13 09:38:55 2004]
[error] [client 10.149.69.114] Use of uninitialized value in concatenation
(.) or string at EllipseApp.pm line 121.\n [Fri Aug 13 09:38:55 2004]
[error] [client 10.149.69.114] DBD::Oracle::st execute failed: ORA-00928:
missing SELECT keyword (DBD ERROR: error possibly near <*> indicator at char
30 in '\n
[Fri Aug 13 09:38:55 2004] [error] [client 10.149.69.114] INSERT
INTO tickets (<*>, , , , , 'O') \n
[Fri Aug 13 09:38:55 2004] [error] [client 10.149.69.114] VALUES
(remedy_ticket_number, date_received, NULL, customer_name, customer_phone,
customer_email, status)\n
[Fri Aug 13 09:38:55 2004] [error] [client 10.149.69.114] ') [for
Statement "\n
[Fri Aug 13 09:38:55 2004] [error] [client 10.149.69.114] INSERT
INTO tickets (, , , , , 'O') \n
[Fri Aug 13 09:38:55 2004] [error] [client 10.149.69.114] VALUES
(remedy_ticket_number, date_received, NULL, customer_name, customer_phone,
customer_email, status)\n
[Fri Aug 13 09:38:55 2004] [error] [client 10.149.69.114] "] at
EllipseApp.pm line 125.\n
I think that *one* problem is the email address. Line 121 above is my SQL
string.
I currently suck at forms. :-\
Robert
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/suppressed/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/suppressed/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.