Cancelado

timer php function

One of my php scripts tends to run a long time because it processes several jobs in a while loop. (It pulls records from a database and processes them.) Potentially, some of these records go on for a very long time or hang, which basically kills the whole process since the next record in the loop is never loaded. So I want to implement a timer in the loop which will prevent any single processing event from executing more than xx seconds. Here's a pseudo-code snippet that illustrates what I'm talking about:

while ($record=mysql_fetch_array($result)){

//ideally a timer would go here, to make sure we don't stay in this record in the loop more than xx seconds

//this is where the code is executed

//sometimes, processing 'stalls' because of network issues within this while loop, which hangs the script because the next record in the array is never 'loaded'

}

Basically, I want something so if the timer comes back with a 'time is up' message, it aborts the current record, returns an error, and the loop can move on to process the next record.

Please feel free to ask me any questions you might have.

Habilidades: PHP

Ver mais: timer php, php free code, network jobs, loop back, current jobs, code php free, php timer loop, timer loop php, event jobs , timer, snippet, pseudo code, processes, prevent, php issues, next move, make loop, hang, free php code, error php, script function, code function, ask php, single php, function time

Acerca do Empregador:
( 24 comentários ) Derby, United States

ID do Projeto: #134167

11 freelancers estão ofertando em média $58 para este trabalho

becomeexpert

Can be done exactly with your 100% satisfaction. Though my bid is a little bit higher, I'm requesting you to have a look at my reviews. Thanks, Tonmay

$100 USD in 2 dias
(129 Comentários)
7.6
Shattenjagger

Let's do it! Please, check PMB.

$30 USD in 0 dias
(27 Comentários)
5.6
ubica

give me code, i will return perfect. Regards

$100 USD em 1 dia
(5 Comentários)
4.6
phpware

Hope the rest of the guys know what they are talking about :). Alex

$50 USD in 3 dias
(21 Comentários)
4.2
izua

Hi there, please check pmb

$35 USD em 1 dia
(13 Comentários)
4.1
Webworkzone

We can surely have the corrections made for you and break the inner loop if it doesn't find the proper condition and have it move on the next condition according to the project requirement. Looking forward for your rep Mais

$60 USD in 2 dias
(9 Comentários)
3.9
kvv20

I have a experience in script speed optimization. Maybe your script need to be rebuild to run faster. The timer you want maybe implemented too

$50 USD em 1 dia
(3 Comentários)
3.8
JulV

I will drop you a PM.

$30 USD em 1 dia
(2 Comentários)
2.6
Narf

I'll fix it.

$30 USD in 2 dias
(0 Comentários)
0.0
requiros

Im new at this site, but a bunch of experience in the area, more than 15

$100 USD in 2 dias
(0 Comentários)
0.0
kingstar4

Hi, Got you, I can fix this thing.

$50 USD em 1 dia
(0 Comentários)
0.0