Jump to content

OFFSET


Faeroth

Recommended Posts

Hello,

 

SQL_RESET(1, "@count"); // Array reset.

query_sql "SELECT count(`nameid`) FROM `inventory` WHERE `char_id` = '" + @char_id[@c]+ "'", @count; // Getting the amount of datasets. Works!

set @current, 0; // OFFSET count reset.

while(@current <= @count[0]) { // As long as there are datasets remaining.

SQL_RESET(2, "@nameid", "@amount"); // Array reset.

query_sql "SELECT `nameid` , `amount` FROM `inventory` WHERE `char_id` = '" + @char_id[@c] + "' LIMIT '" + @current + "' OFFSET 127", @nameid, @amount; // Does not work!

set @current, @current + 127; // Next time start 127 onward.

for( set @i, 0; @i < getarraysize(@nameid); set @i, @i + 1 )

	mes @nameid[@i] + " -> " + @amount[@i]; // Return the datasets. Does not work!

next; // Ignore this.

}

 

That's the idea:

In this script language, there is a limit of 127 indexes for the arrays.

Therefore I wanted to let MYSQL get only 127 datasets and the next time the following 127.

The first MYSQL-Query works fine, but the second with the OFFSET does not.

I guess I did not understand OFFSET correctly...

 

Thanks in advance!

Link to comment
https://forums.phpfreaks.com/topic/97377-offset/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.