Gossamer Forum
Home : Products : Others : MySQLMan :

MySQL Syntax error

Quote Reply
MySQL Syntax error
Your script uploaded and worked perfectly the first go. Well done.
When trying to edit a table I got the following message:
Error

MySQL said: You have an error in your SQL syntax near '(0x102b2430)' at line 1.

Query: SELECT * FROM cc_object WHERE CGI=HASH(0x102b2430)

I found a semi-colon seemed to be missing on line 789 of the cgi file
elsif ($action eq 'update') { &update_record($in) }

but that did not fix the problem.

Also, I when I try to delete a record I get:

Error

MySQL said: You have an error in your SQL syntax near '(0x102b21d8) LIMIT 1' at line 1.

Query: DELETE FROM delphi_cats WHERE CGI=HASH(0x102b21d8) LIMIT 1


Thanks for a great script - hope you can help me get this small problem working.

Richard

Quote Reply
Re: MySQL Syntax error In reply to
Hello,

It appears that you have an older version of the CGI module (CGI.pm). Newer versions of this module can be downloaded at:

http://www.perl.com/...dules/by-module/CGI/

Once you have upgraded the module, the problem should be solved automatically.

If you do not wish to upgrade the module, then you can add the following sub-routine in mysql.cgi:

Code:
sub escape {
$DefaultClass = 'CGI' unless defined $CGI::DefaultClass;

shift() if ref($_[0]) || $_[0] eq $DefaultClass;
my $toencode = shift;
return undef unless defined($toencode);
$toencode=~s/([^a-zA-Z0-9_.-])/uc sprintf("%%x",ord($1))/eg;
return $toencode;
}
... and replace each $in->escape($var) with &escape($var) where $var stands for any variable.

This will be fixed in the next release to avoid the problem from occurring again.

Cheers,

--
Gossamer Threads, Inc.