yakoval has asked for the wisdom of the Perl Monks concerning the following question:
When I attempt to use the next query:
SELECT news.id FROM news LIMIT 1 OFFSET ?
And in a code I write
$offset = int(rand(100)); $sth->execute($offset);
I get the following error back from DBD::mysql
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 ''55'' at line 1.
I understand that placeholder is not allowed in LIMIT or OFFSET clause of SELECT statement.
How can I overcome this problem?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using placeholders in OFFSET clause of SELECT statement
by tinita (Parson) on Apr 29, 2010 at 11:18 UTC | |
|
Re: Using placeholders in OFFSET clause of SELECT statement
by ikegami (Patriarch) on Apr 29, 2010 at 01:26 UTC | |
by yakoval (Novice) on Apr 29, 2010 at 19:23 UTC | |
|
Re: Using placeholders in OFFSET clause of SELECT statement
by balakrishnan (Monk) on Apr 29, 2010 at 08:03 UTC |