Reputation: 563
I have made a script that run various loops and does some SQL inserts. I can't post it as it's just too big, and it's unfair for people to try and fix it.
But, as I get more and more things for it to loop, it appears to be struggling to calculate everything and failing to assign values to arrays sometimes.
For example $myvar[$i] = 'abc'
just doesn't work. I echoed the values before I assigned them to make sure I wasn't trying to insert null
s, but that's not the case.
I reordered the loop to see if it was somehow related to other data problems, but the missing values were random. I have tried and tried to work out how to fix this, I bumped up the memory allowance, checked my timeout settings, it's all fine.
I tried uploading the script in binary and ASCII, didn't solve it.
I tried deleting white space around the top and bottom, didn't solve it.
I checked to see if my version was out of date, its PHP Version 5.3.4 - problem?
I gently rocked my pc from side to side, didn't solve it...
I've never seen PHP screw up like this, it's always my fault. But this time it seems like PHP is the issue here.
My questions are:
Upvotes: 0
Views: 102
Reputation: 2432
Try using addslashes() or mysql_real_escape_string() for your values and see if that works.
A while back I had a problem with something that sounds (only vaguely) similar to what your describing. Kept hitting my head against the wall until I realized what I had left out.
If that doesn't work your first step would be to figure out what values it's accepting and which it isn't. Look for a pattern. If it's truly random then that's one thing, but it rarely is.
Upvotes: 0
Reputation: 9355
Upvotes: 6