Reputation: 2436
Good morning!
I'm trying to do something that should be fairly simple, but I haven't been able to find a working answer. I'm trying to pull down entries 0-999 from a table, then 1000-1999, 2000-2999, etc. Here's what I've got so far, but it's still pulling down 0-999+ as it increments
for($k = 0; $k < 10000; $k += 1000)
{
$query = "select * from TABLENAME LIMIT 1000 OFFSET " . $k;
.....
}
Upvotes: 0
Views: 180
Reputation: 11830
$start = 0;
$end = 0;
for($k = 0; $k < 10000; $k += 1000)
{
$flag = $start+999;
$end = 1000;
$query = "select * from TABLENAME LIMIT $start,$end";
.....
$start = $flag+1;
}
Upvotes: 0
Reputation: 8090
Try this:
for($k = 0; $k < 10000; $k += 1000)
{
$query = "select * from TABLENAME LIMIT {$k},1000";
.....
}
Upvotes: 3