I'm using a while loop to fill in a DB table that ends up looking something like this:
start: end:
00:00 00:10
00:10 00:15
00:15 00:21
00:21 00:23
You get the idea. So there's a while loop where I pull the max('end') and make that the 'start' of the new row. There's a totally separate function that gives me a duration, so I add that to the new row's 'start' and that gives me the 'end' for the new row. This happens a bunch of times.
The problem is that ->max('end') gives me the correct value on the first pass through the while loop, but then just keeps returning that same value even after new rows with later 'end' times have been saved to the database.
It seems to be caching the ->max('end') and just referring back to that instead of updating after the ->save() happens. Is there any way around this? If it's going to cause a big performance hit, I suppose I can work around it by incrementing a variable in the while loop. But wanted to know if I was doing something wrong.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1WegIKM
via IFTTT
Aucun commentaire:
Enregistrer un commentaire