From: Peter J. Holzer on
On 2010-02-14 16:39, Henry Law <news(a)lawshouse.org> wrote:
> I'm trying to do something very simple: query an existing MYSQL table
> for a single row or set of similar rows. Code fragment below. I'm
> getting "Illegal parameter number" but my code looks perfectly correct.
> I've looked at the module source and the appropriate section is
[...]
> ------------ code fragment (not executable as it is ) ------------
>> my $qry_sth = $dbh->prepare("SELECT * FROM master WHERE name='?' ORDER BY mod_date DESC")

This query contains NO parameters. It contains the constant string '?'.

I assume you meant

my $qry_sth = $dbh->prepare("SELECT * FROM master WHERE name=? ORDER BY mod_date DESC")

instead.

hp

From: Henry Law on
Peter J. Holzer wrote:
> On 2010-02-14 16:39, Henry Law <news(a)lawshouse.org> wrote:
>> I'm trying to do something very simple: query an existing MYSQL table
>> for a single row or set of similar rows. Code fragment below. I'm
>> getting "Illegal parameter number" but my code looks perfectly correct.

>> ------------ code fragment (not executable as it is ) ------------
>>> my $qry_sth = $dbh->prepare("SELECT * FROM master WHERE name='?' ORDER BY mod_date DESC")
>
> This query contains NO parameters. It contains the constant string '?'.


Well, it's not often that I laugh out loud at the simplicity of my
error. I knew that "name" is alphanumeric, so I put in the single
quotes that the query engine needs when you use the command line. Duh...

Thank you very much.

--

Henry Law Manchester, England