On Wed, Aug 18, 2010 at 6:55 PM, Babale Fongo <[email protected]> wrote:
> Below are 2 pieces of code. Both have been tested with space in the string
> and again without space.
>
> $limit = "$offset,$number_rows" or $limit = "$offset, $number_rows";
>
> [snip...]
>
> 2) This works fine (with or without space in the string).
>
> my $sth = $dbh->prepare(qq{
> Select fname, lname, dob, substr(desc, 1, 200) from user
> left join personal_data on
> user.id = personal_data.id where gender = ? and position =
> ?
> order by lname limit $limit
> });
> $sth->execute($gender, $role);
>
If DBI treats it as two values, maybe passing two value will work. Something
like this code...
my $sth = $dbh->prepare(qq{
Select fname, lname, dob, substr(desc, 1, 200) from user
left join personal_data on
user.id = personal_data.id where gender = ? and position = ?
order by lname limit ?,?
});
$sth->execute($gender, $role, $offset, $number_rows);
--
Robert Wohlfarth