monkeypaw201 Posted April 22, 2008 Share Posted April 22, 2008 I have the interesting challenge of updating 6,012 rows every 20 minutes :o if i try to run a script that large, i think the server would die.. so instead i would like to break it up into 5-10 different pages/crons that each run a little chunk of it.. Onto the problem, i know how to get it to stop at a certain number, but how do i tell it to start up at a number other than the beginning? Link to comment https://forums.phpfreaks.com/topic/102264-solved-start-at-1-and-end-at-500-restart-at-501-and-stop-at-1000-possible/ Share on other sites More sharing options...
DarkWater Posted April 22, 2008 Share Posted April 22, 2008 Why exactly do you need to update 6,012 rows every 20 minutes? Link to comment https://forums.phpfreaks.com/topic/102264-solved-start-at-1-and-end-at-500-restart-at-501-and-stop-at-1000-possible/#findComment-523601 Share on other sites More sharing options...
monkeypaw201 Posted April 22, 2008 Author Share Posted April 22, 2008 The company i work for needs continuously updated information based on several sources to reliably re-direct incoming information... its a long story.. Any ideas? Link to comment https://forums.phpfreaks.com/topic/102264-solved-start-at-1-and-end-at-500-restart-at-501-and-stop-at-1000-possible/#findComment-523603 Share on other sites More sharing options...
mrdamien Posted April 22, 2008 Share Posted April 22, 2008 Depending on how your updating them, you can create loops like so: for($i = 0; $i < 500; $i++){ //stuff } for($i = 500; $i < 1000; $i++){ // stuff again } or with the SQL LIMIT "UPDATE tbl SET row = 'test' WHERE condition = "yes" LIMIT 0, 500" "UPDATE tbl SET row = 'test' WHERE condition = "yes" LIMIT 500, 1000" Link to comment https://forums.phpfreaks.com/topic/102264-solved-start-at-1-and-end-at-500-restart-at-501-and-stop-at-1000-possible/#findComment-523606 Share on other sites More sharing options...
monkeypaw201 Posted April 22, 2008 Author Share Posted April 22, 2008 Yes, the SQL limit is what i was looking for, so the bold numbers are the start/stop numbers? "UPDATE tbl SET row = 'test' WHERE condition = "yes" LIMIT 0, 500" "UPDATE tbl SET row = 'test' WHERE condition = "yes" LIMIT 500, 1000" Link to comment https://forums.phpfreaks.com/topic/102264-solved-start-at-1-and-end-at-500-restart-at-501-and-stop-at-1000-possible/#findComment-523608 Share on other sites More sharing options...
DarkWater Posted April 22, 2008 Share Posted April 22, 2008 Yes, the SQL limit is what i was looking for, so the bold numbers are the start/stop numbers? "UPDATE tbl SET row = 'test' WHERE condition = "yes" LIMIT [b]0[/b], [b]500[/b]" "UPDATE tbl SET row = 'test' WHERE condition = "yes" LIMIT [b]500[/b], [b]1000"[/b] Nope. Do it like this: UPDATE tbl SET row='test' WHERE condition ="yes" LIMIT 0, 500; UPDATE tbl SET row='test' WHERE condition ="yes" LIMIT 500, 500; UPDATE tbl SET row='test' WHERE condition ="yes" LIMIT 1000, 500; UPDATE tbl SET row='test' WHERE condition ="yes" LIMIT 1500, 500; Now do that in a script. Link to comment https://forums.phpfreaks.com/topic/102264-solved-start-at-1-and-end-at-500-restart-at-501-and-stop-at-1000-possible/#findComment-523610 Share on other sites More sharing options...
mrdamien Posted April 22, 2008 Share Posted April 22, 2008 Yeah sorry, I always make that mistake. LIMIT (Offset), (Amount) Link to comment https://forums.phpfreaks.com/topic/102264-solved-start-at-1-and-end-at-500-restart-at-501-and-stop-at-1000-possible/#findComment-523612 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.