Thanks for pushing me in the right direction :)  It turns out that it 
wasn't the semicolon on the end of $sql_query -- it was the newline.  I had 
been invoking it as follows:
./rundatabasequery.cgi 
sql_query=SELECT+*+FROM+newssites_dynamicdata%3B%0D%0A
and the "%0D%0A" was a hex-encoded newline that got appended to the end of 
$sql_query.  Removing that newline made the query work.

         -Bennett

At 03:25 PM 8/13/2001 +0200, Ian Barwick wrote:
>On Sunday 12 August 2001 01:01, Bennett Haselton wrote:
> > I've written a CGI script that runs a database query on a MySQL 
> database (I
> > know that's risky -- it's password-protected though, for what it's
> > worth). (...)
>
>It's a free world ;-)
>
> > When I run the script with the first of these two lines commented out, 
> and
> > the second one uncommented:
> >
> > #my $sql_query = $q->param('sql_query');
> > my $sql_query = "SELECT * FROM newssites_dynamicdata;";
>                                                       ^
>(rest of mail snipped)
>
>Try leaving out the trailing semicolon from all queries.
>
>Semicolons are only really useful when using the mysql client, where they
>signify the end of a statement (alternatively you can use \g). In DBI
>statements they will, more likely than not, cause errors. And as they 
>aren't
>in any way necessary, save yourself the trouble they might cause...
>
>HTH
>
>Ian Barwick
>
>--
>Ian Barwick - Developer - [EMAIL PROTECTED]
>akademie.de asp GmbH - http://www.akademie.de
>
>"To query tables in a MySQL database is more fun than eating spam"
>
>---------------------------------------------------------------------
>Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
>To request this thread, e-mail <[EMAIL PROTECTED]>
>To unsubscribe, e-mail 
><[EMAIL PROTECTED]>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


[EMAIL PROTECTED]     http://www.peacefire.org
(425) 649 9024


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to