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

pangaoyong pangaoyong at 126.com
Fri Jun 9 04:19:01 BST 2006


Thanks, it is very clear and works now.

-----ԭʼÓʼþ-----
·¢¼þÈË:"Rod McChesney" <rod.mcchesney at gmail.com>
·¢ËÍʱ¼ä:2006-06-09 11:06:43
ÊÕ¼þÈË:"pangaoyong" <pangaoyong at 126.com>
³­ËÍ:"classdbi" <classdbi at lists.digitalcraftsmen.net>
Ö÷Ìâ:Re: [CDBI] how to use variable as column name in set _sql



On 6/8/06, pangaoyong &lt;pangaoyong at 126.com&gt; wrote:
[snip]
&gt; 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 "
&gt;
&gt;     SELECT DISTINCT price
&gt;     FROM   product
&gt;     WHERE  name = ? order by
&gt;
&gt; you could see that the second %s is not passed in, the first %s is ok, could
&gt; someone give me a clue?

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

$class-&gt;sql_distinctByProduct($col, $col)-&gt;select_col($productName);

Rod

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digitalcraftsmen.net/pipermail/classdbi/attachments/20060609/5c76c8f8/attachment.html


More information about the ClassDBI mailing list