Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

LIMIT ... OFFSET ... does not work with sqlpage variables in MySQL #1154

Copy link
Copy link
@srcarvalho12

Description

@srcarvalho12
Issue body actions

I can't use variables defined with "SET" in offset in MariaDB.

error returned from database: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CAST(? AS CHAR) OFFSET CAST(? AS CHAR)' at line 1

I'm defining the variables like this:

set limite = 10;
set offset = (COALESCE($page, 1) - 1) * $limite;

And then I'm trying to use them in the consultation:

...
order by
    id desc
limit $limite
offset $offset;
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.