BlackSparrow Posted November 5, 2011 Share Posted November 5, 2011 Did PHP a few years ago and for the life of me i can't work out why this doesn't work: for ( $counter2=1; $counter2 < 1000; $counter2++) { for ( $counter1=1; $counter1 < 1000; $counter1++) { echo "Fixed bug"; } } and yet this does for ( $counter2=1; $counter2 < 100; $counter2++) { for ( $counter1=1; $counter1 < 100; $counter1++) { echo "Fixed bug"; } } I tested it because I have a rather large amount of data to retrieve from an XML file and i kept receiving errors Quote Link to comment Share on other sites More sharing options...
RussellReal Posted November 5, 2011 Share Posted November 5, 2011 the first code sample is essentially looping 1,000,000 times.. You're in essence outputting 10^6*strlen('fixed bug'); which obviously will be ALOT of data, its a little over 8mb, which could be timing out for you.. the php code is obviously good.. Also, your server may be preventing you from sending files bigger than a certain amount (many servers do have this limitation.. especially shared hosting, mostly to prevent file sharing and media streaming) but if it is NOT that problem, than, I hope you can find a solution here at PHPFreaks Quote Link to comment Share on other sites More sharing options...
BlackSparrow Posted November 5, 2011 Author Share Posted November 5, 2011 Oh ok well I basically have 1000 rows and each row has 10 columns. I would like to be able to collect this data from the xml file and display it (use it in list boxes etc) so I figured this would be a way of doing that (obviously not the two loops above but a loop to go over all rows and another nested loop to go though the cells). But if it a file size return issue (I'm just running this on a test account at award space so its very possible that it is and thanks for pointing that out to me) then I wonder how I can get around it? Quote Link to comment Share on other sites More sharing options...
RussellReal Posted November 5, 2011 Share Posted November 5, 2011 You can possibly contact the support for your web hosting, as you're a shared hosting I'm more than sure you don't have access to modify apache config files, etc.. I don't think your web hosting will lift this limitation, as on shared hosting you're not the only 1 using that 1 installation of apache, However, its still a good idea to talk to them, as it could be something else (dunno what else, but its always possible).. Quote Link to comment 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.