andrewgarn Posted June 20, 2008 Share Posted June 20, 2008 I have a created a complex page which cycles through a set of data and updates the information on the database. Sometimes it works fine, but usually it takes a long time, then firefox gives me an option to "download" the page. I presume this is something to do with the page timing out, I dont have access to the php.ini file so i cant change that. Is there any way to stop this from happening in the php file itself? Quote Link to comment Share on other sites More sharing options...
DarkWater Posted June 20, 2008 Share Posted June 20, 2008 Check out set_time_limit() in the PHP Manual. Quote Link to comment Share on other sites More sharing options...
andrewgarn Posted June 20, 2008 Author Share Posted June 20, 2008 <?php set_time_limit(999); ?> Same problem with it at the top Quote Link to comment Share on other sites More sharing options...
Jabop Posted June 20, 2008 Share Posted June 20, 2008 Sometimes it works fine, but usually it takes a long time, then firefox gives me an option to "download" the page. This seems like it's not outputting the headers properly. If it was a time limit it would error out telling that the time to process has exceeded the max. Quote Link to comment Share on other sites More sharing options...
andrewgarn Posted June 20, 2008 Author Share Posted June 20, 2008 Sometimes it works fine, but usually it takes a long time, then firefox gives me an option to "download" the page. This seems like it's not outputting the headers properly. If it was a time limit it would error out telling that the time to process has exceeded the max. didnt realise php pages needed headers, <-- must sound stupid but all my php is self taught my experimenting. currently most of my php pages just have php code in them, and as the page is just designed to process, not specifically to output anything Quote Link to comment Share on other sites More sharing options...
DarkWater Posted June 20, 2008 Share Posted June 20, 2008 Can we see the code? Quote Link to comment Share on other sites More sharing options...
andrewgarn Posted June 20, 2008 Author Share Posted June 20, 2008 Can we see the code? I pmed it to you, please dont share the code publically Quote Link to comment Share on other sites More sharing options...
Jabop Posted June 20, 2008 Share Posted June 20, 2008 Change your code so it's not a hazard to post it publicly, if you want help. Quote Link to comment Share on other sites More sharing options...
DarkWater Posted June 20, 2008 Share Posted June 20, 2008 Oh, I think I helped you with this script, lol. But it was much simpler before. Umm...so do you know after how long it sends you the file? Like, 30 seconds, 45 seconds, 300 seconds? Any idea? Quote Link to comment Share on other sites More sharing options...
andrewgarn Posted June 20, 2008 Author Share Posted June 20, 2008 Oh, I think I helped you with this script, lol. But it was much simpler before. Umm...so do you know after how long it sends you the file? Like, 30 seconds, 45 seconds, 300 seconds? Any idea? Roughly 30 seconds. and yes it is quite complicated, the long load time is fine as the pages will be run automatically by an online cron service and not be viewed by users. Quote Link to comment Share on other sites More sharing options...
lemmin Posted June 20, 2008 Share Posted June 20, 2008 Does it also send the file in Internet Explorer? Quote Link to comment Share on other sites More sharing options...
andrewgarn Posted June 20, 2008 Author Share Posted June 20, 2008 Does it also send the file in Internet Explorer? Not sure, just loaded it in IE and it loaded properly 3 times running but it loaded much faster than 30secs so it might not be timing out like in FF. Quote Link to comment Share on other sites More sharing options...
andrewgarn Posted June 20, 2008 Author Share Posted June 20, 2008 The code is here: http://idire.freehostia.com/updatetracking.txt to view. Quote Link to comment Share on other sites More sharing options...
andrewgarn Posted June 20, 2008 Author Share Posted June 20, 2008 as a side question, i might be going crazy, but why doesnt this work? <?php INSERT INTO CHANGE ( id_status, username ) VALUES ( 'today', 'user1' ) ?> #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CHANGE ( id_status, username ) VALUES ( 'today', 'user1' Quote Link to comment Share on other sites More sharing options...
lemmin Posted June 20, 2008 Share Posted June 20, 2008 From looking at your code, I wouldn't be surprised if the issue was memory related. it seems like you just keep copying variables with no real reason to. Why do you copy the variables like $overall_rank when you don't use the previous one? Since there isn't anything obviously wrong with the code and since it is possible that there is a memory issue, I would suggest trying to clean up some variables. You could even do: $c[0][0] = $c[0][0] - $r["overall_rank"]; And, systematically, nothing above would be changed and you would use two less variables. Quote Link to comment Share on other sites More sharing options...
lemmin Posted June 20, 2008 Share Posted June 20, 2008 as a side question, i might be going crazy, but why doesnt this work? <?php INSERT INTO CHANGE ( id_status, username ) VALUES ( 'today', 'user1' ) ?> #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CHANGE ( id_status, username ) VALUES ( 'today', 'user1' CHANGE is a reserved word, you need to put back quotes around it to make it literal. INSERT INTO `CHANGE` ( id_status, username ) VALUES ( 'today', 'user1' ) Quote Link to comment Share on other sites More sharing options...
andrewgarn Posted June 20, 2008 Author Share Posted June 20, 2008 thank you, that fixed that, still having the problem on firefox though. I removed one variable and replaced with the split variable as you suggested. Its now timing out on both ie and FF Quote Link to comment Share on other sites More sharing options...
lemmin Posted June 20, 2008 Share Posted June 20, 2008 How many rows are returned from your first query of "SELECT * FROM user where track = 'Yes'"? Try commenting out that outer while loop and manually set $username to a test one that exists and see if it still times out. I'm pretty sure it won't time out if you do that, and if it doesn't I think I know what the problem is. Quote Link to comment Share on other sites More sharing options...
andrewgarn Posted June 20, 2008 Author Share Posted June 20, 2008 How many rows are returned from your first query of "SELECT * FROM user where track = 'Yes'"? Try commenting out that outer while loop and manually set $username to a test one that exists and see if it still times out. I'm pretty sure it won't time out if you do that, and if it doesn't I think I know what the problem is. 13 currently, users register with the site to add themselves to the tracker Quote Link to comment Share on other sites More sharing options...
andrewgarn Posted June 21, 2008 Author Share Posted June 21, 2008 Still having the same problem Quote Link to comment Share on other sites More sharing options...
andrewgarn Posted June 22, 2008 Author Share Posted June 22, 2008 any ideas? Quote Link to comment Share on other sites More sharing options...
lemmin Posted June 23, 2008 Share Posted June 23, 2008 Did you try: commenting out that outer while loop and manually set $username to a test one that exists and see if it still times out.? 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.