divinedesigns1 Posted July 22, 2012 Share Posted July 22, 2012 i keep getting this error for the pass 3 days and im still pluzzed on how to fix this error Fatal error: Maximum execution time of 30 seconds exceeded in C:\wamp\www\albumfakeness\gallery.php on line 37 it always take longer than 30 seconds to load a page but i never got this error before can someone help please Link to comment Share on other sites More sharing options...
birbal Posted July 22, 2012 Share Posted July 22, 2012 using set_time_limit(0) will fix the problem but you should find the reason why it is taking so long time. the default execution time is set to 3o seconds, usually general web apps does not take such long time to execute. Link to comment Share on other sites More sharing options...
divinedesigns1 Posted July 22, 2012 Author Share Posted July 22, 2012 using set_time_limit(0) will fix the problem but you should find the reason why it is taking so long time. the default execution time is set to 3o seconds, usually general web apps does not take such long time to execute. its being cause when i try to count and display a certain information Link to comment Share on other sites More sharing options...
birbal Posted July 22, 2012 Share Posted July 22, 2012 usually counting something and displaying it would not take such a long time to get this error.showing the code would be helpfull rather than assuming something. Link to comment Share on other sites More sharing options...
divinedesigns1 Posted July 22, 2012 Author Share Posted July 22, 2012 this is the code <?php// Retrieve album information (photo count, description, etc.) from database$sql = "SELECT album.album_id, album.album_name, album.album_desc, album.album_cover, COUNT(photo.photo_id) as imagesFROM album LEFT JOIN photo ON album.album_id = photo.album_idGROUP BY album.album_name, album.album_descORDER BY album.album_id ASC";$result = mysql_query($sql) or die("Error retrieving records from the database: " . mysql_error());$i = 0; // Row counterwhile( $row = mysql_fetch_assoc($result)){$data[] = $row;}$count = (ceil(count($data) / IMAGE_DISPLAY ));for($i = (int)0; $i < $count * IMAGE_DISPLAY;){if(($i % IMAGE_DISPLAY) == 0 && ($i != 0)){echo("</tr>\n<tr>");}if($data['album_cover']){echo("<td valign=\"top\" width=\"" . floor(100 / IMAGE_DISPLAY) . "%\">\n");echo("<p><a href=\"view_album.php?album_id=" . $data[$i]['album_id'] . "\">" . $data[$i]['album_name'] . " (" . $data[$i]['images'] . ")</a></p><a href=\"view_album.php?album_id=" . $data[$i]['album_id'] . "\"><img src=\"" . $data[$i]['album_cover'] . "\" title=\"" . $data[$i]['album_desc'] . "\" align=\"middle\"></a>");echo("<br /><p>" . $data[$i]['album_desc'] . "</p>\n</td>\n");}else{echo("<td valign=\"top\" width=\"" . floor(100 / IMAGE_DISPLAY) . "%\"> ");echo("</td>\n");}}?> line 37 is where it says for($i = (int)0; $i < $count * IMAGE_DISPLAY;){what is suppose to do it check if int being the id is 0, then check to see if count is 1 or more Link to comment Share on other sites More sharing options...
Don E Posted July 22, 2012 Share Posted July 22, 2012 Are you incrementing $i in the for loop anywhere? (not sure if that's the problem, just pointing that out) for($i = (int)0; $i < $count * IMAGE_DISPLAY; $i++) Link to comment Share on other sites More sharing options...
divinedesigns1 Posted July 22, 2012 Author Share Posted July 22, 2012 ahhh that was the problem, but now i ended up with an offset error psssh Undefined offset: 2 in C:\wamp\www\albumfakeness\gallery.php on line 43 ill try and figure this one out, if i cant ill ask for help once needed Link to comment Share on other sites More sharing options...
divinedesigns1 Posted July 22, 2012 Author Share Posted July 22, 2012 error fixed but its not displaying the album psssh Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now