On Jul 31, Octavian Rasnita said:

select ... limit 0,30;

but I cannot use:

$sth = $dbh->prepare("select ... limit ?,?");
$sth->execute(0, 30);

... because DBI replaces the values entered with '0' and '30' and the query
won't be valid.

No, you probably can't do that because your SQL engine doesn't allow placeholders in LIMIT. All you need to do is make sure the values are non-negative integers, and you can write

  $sth = $dbh->prepare("select ... limit $start, $length");

If you need to escape things, you $dbh->quote(...).

--
Jeff "japhy" Pinyan         %  How can we ever be the sold short or
RPI Acacia Brother #734     %  the cheated, we who for every service
http://japhy.perlmonk.org/  %  have long ago been overpaid?
http://www.perlmonks.org/   %    -- Meister Eckhart

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to