Seems that you are not taking advantage of Perl. This is what you can do: $parentid = x; $orderby = 'DESC'; my $sth = $dbh -> prepare (qq{ SELECT message.name, contents, user.name, message.id FROM message, user WHERE folder='N' and parentid=$parentid GROUP BY message.id ORDER BY time $orderby }) || die $dbh->errstr; You can put any variable inside the string... Note that I changed the q{ ... } to qq{ ... } $string = q{ string } is the same as $string = 'string'; $string = qq{ string } is the same as $string = "string"; Note that variables inside of strings enclosed by '' will not be translated, only strings enclosed by "" (or qq{} =) ). Hope that helps. For more info goto www.perl.com ryan > I'm having some trouble passing some information from my Perl script to > the DBI query interface. > > A short version of my query would look like: > > my $sth = $dbh -> prepare (q{ > SELECT message.name, contents, user.name, message.id > FROM message, user > WHERE folder='N' and parentid=? > GROUP BY message.id > ORDER BY time ? > }) || die $dbh->errstr; > > Then, I'm calling the query: > > $sth->execute($parent, "DESC"); > > The "DESC" is being ignored. I can hard-code it into the query and it > works fine. The closest I've been able to achive in having the query > recognize the second ? is to have it crash with an error reporing that > it's there, but doing nothing about it.... > > go figure. > > any help is greatly appreciated. > -- > *****=======| http://bigpig.org/ > *****=======| > *****=======| It's about Freedom! > ============| > > --------------------------------------------------------------------- > 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 > --------------------------------------------------------------------- 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