Re: [CDBI] how to use variable as column name in set _sql

"Rod McChesney" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.class-dbi
Message-ID <[email protected]>
On 6/8/06, pangaoyong <[email protected]> wrote:
[snip]
> DBD::mysql::st execute failed: You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3 [for Statement "
>
>     SELECT DISTINCT price
>     FROM   product
>     WHERE  name = ? order by
>
> you could see that the second %s is not passed in, the first %s is ok, could
> someone give me a clue?

Looks to me like you need a second argument for the "order by" %s:

$class->sql_distinctByProduct($col, $col)->select_col($productName);

Rod
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.