PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Daz <dazol at patriot dot net>
Subject: update question
Date: Aug 17 1999 4:02PM

New to the list so please bear with me :)
Also new to perl, so more 'bearing' please ;)

I am trying to write a CGI script that will call a certain row from
MSSQL 6.5, save the results into one variable, take the cgi input as the
second variable concatonate the two, then update the previously called
row with the new information (making sure to keep the original
information).  the newest problem (Ive solved most, I think) is this
error:

Server message:
Message number: 105, Severity 15, State 1, Line 1 
Server 'SERVERNAME'
Message String: Unclosed quote before the character string 'how'.

Server Message:
Message number: 170, Severity 15, State 1, Line 1
Server 'SERVERNAME'
Message String: Line 1: Incorrect syntax near 'how'.

The only text this particular column has is the word 'how'.  
Here is the code I am using(I know its goulish, but Ive only been using
perl for a month or so)


#!/usr/bin/sybperl
BEGIN {
	$ENV{SYBASE} = '/home/opt/sybase';
}
use CGI;
use Sybase::CTlib;
use CGI qw (:standard);
my $query= new CGI;
print $query->header;
print $query->start_html(-title =>"Update a Ticket",
			  -bgcolor => '#FFFFFF');
print qq[

Upate a ticket

]; print $query->startform; print qq[

Put in some garbage

]; print $query->textfield( -name => 'test' ); print $query->submit; print $query->endform; #attempt the sql part $dbh = new Sybase::CTlib ('username', 'password', 'DATABASE'); if ($query->param('test')) { $dbh->ct_sql("use DATABASE"); $test = $query->param('test'); my $cmd1 = qq[SELECT resolution FROM calls WHERE callnumber = 30000]; my @rows = $dbh->ct_sql($cmd1); my $thisrow; foreach $thisrow (@rows) { my $test2 = ${$thisrow}[0]; print qq[

$test2

]; my $test3=("$test2" . "$test"); $cmd = qq[UPDATE calls SET resolution = "$test3" where CALLNUMBER = 30000]; $dbh->ct_sql("use DATABASE"); $dbh->ct_sql($cmd); print qq[

$test3

]; } } print $query->end_html; Any suggestions would be most appreciated. David