Skip to content Skip to sidebar Skip to footer

Sql Limit Return 'zero' - 0 - Rows(in Php)

I have an error in this query, when the query returns zero rows. Error Number: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server ve

Solution 1:

The OFFSET value of the LIMIT clause has to be a nonnegative integer constant. Quoting the MySQL Documentation:

The LIMIT clause can be used to constrain the number of rows returned by the SELECT statement. LIMIT takes one or two numeric arguments, which must both be nonnegative integer constants (except when using prepared statements).

Solution 2:

You can not specify negative value to LIMIT clause:

LIMIT -20,20 

It means you want to return 20 rows starting from -20 which is wrong.

Solution 3:

The limit cannot be negative.

Post a Comment for "Sql Limit Return 'zero' - 0 - Rows(in Php)"