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

Rod McChesney rod.mcchesney at gmail.com
Fri Jun 9 04:06:43 BST 2006


On 6/8/06, pangaoyong <pangaoyong at 126.com> 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



More information about the ClassDBI mailing list