Jump to content

fatal error


jeff5656

Recommended Posts

The following script converts the "rcf_date" field (varchar) to "rcf_date2" (date format) in the table "active_consults".

 

On my test server it works.

When I put I applied it to the actual database (930 records) I get:

 

Fatal error: Maximum execution time of 30 seconds exceeded in C:\wamp\www\consults\convertdate-3.php on line 9

 

Here is code that produces that error:  Any ideas?

 

<?php include "connectdb.php"; 


$query = mysql_query("SELECT * FROM active_consults")or die(mysql_error());
while($info = mysql_fetch_array( $query ))
{
$newdate = date("Y-m-d", strtotime($info['rcf_date']));
$upq = "update active_consults set rcf_date2 = '$newdate' where id_incr = '" . $info['id_incr'] . "'";
   $rs = mysql_query($upq) or die("Problem with the update query: $upq<br>" . mysql_error());
   
}
?>

Link to comment
https://forums.phpfreaks.com/topic/101690-fatal-error/
Share on other sites

Running two queries (SELECT and UPDATE) and two slow php functions (date() and strtotime()) for every row is bound to take a long time. Since this is a one time operation, running a single query that updates all the rows at one time in your database administration tool (phpmyadmin or mysql administrator...) would have been the simplest solution.

Link to comment
https://forums.phpfreaks.com/topic/101690-fatal-error/#findComment-520350
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.