kingoflosses Posted October 27, 2007 Share Posted October 27, 2007 Basically what I have is a script that loops through a set of numbers retrieved from a table in my database (using a "while" loop) and then using an included class it parses an external xml file and returns the results in an array. It then take the data from selected keys of the array I need and uses them to update the row from which the original number was pulled. The problem I'm running into is I'm randomly failing to receive the data from my xml parse/array. Sometimes my script will run perfectly for the first 1000 entries or so and then have random dropouts, while other times I will receive sporadic data from the beginning. I'm pretty sure I have ruled out script timeout and lack of memory and I've tried everything I can think of to find the problem. I don't receive any php or mysql errors while running my script, so that hinders me in trying to pinpoint the problem. One idea I had was that the xml page might not be loading and being parsed fast enough and it was being skipped in my while loop, but I'm not sure how I would check for that or how I would remedy it. The method I'm using to see if I'm receiving data in my array from the xml parse is a simple if/else statement in my while loop. In the "If" statement I look for a certain array key that should be present, and if it returns null I have it echo the number pulled from my table in red font color. Otherwise I have it echoing the number in blue font. I have no clue where to go from here in my troubleshooting. I've tried too many approaches to fixing this to post them all here, and I'm not sure what part of my script would be best to post at this point. Actually, I'm not even positive if it's a problem with my original php script, my xml to array class, or something wacky with mysql. Any help is greatly appreciated though. If it helps, I'm using php 4.4.7 on an Apache webserver. Quote Link to comment https://forums.phpfreaks.com/topic/74981-sporadic-data-loss/ Share on other sites More sharing options...
phpknight Posted October 27, 2007 Share Posted October 27, 2007 I have a few similar weird issues with mySQL every once in a while failing on a query where the server goes away. I've checked with the server people and spent countless hours tracking it down without any luck. If it runs perfectly but has this issue every 3000 times or something, I wouldn't worry about it. If it happens every other time, then obviously you have to continue to track it down. I seriously doubt it is your PHP code as long as you know what you are doing (and it sounds like you probably do). Quote Link to comment https://forums.phpfreaks.com/topic/74981-sporadic-data-loss/#findComment-379192 Share on other sites More sharing options...
kingoflosses Posted October 27, 2007 Author Share Posted October 27, 2007 Well, I'm pretty sure it's not a problem with my mysql queries because I am receiving the correct row number every time during my "While" Loop. The rate at which I fail to receive my array data varies wildly. Sometimes it will go fine for a while, and then I will lose large chunks. This is an example of the problem I've been running into. Each number in blue is a success and each red is a fail. If you refresh the script you will see that the number, position and frequency of red numbers changes each time. It's driving me crazy and I would like to avoid having to run numerous crons during the day just to be sure the entire list gets updated. Again, thanks for any help that can be offered Quote Link to comment https://forums.phpfreaks.com/topic/74981-sporadic-data-loss/#findComment-379357 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.