Php and thesql script timeout with no errors

By | October 11, 2023

Below is my code, it is a script I need to run just 1 time to update a new mysql table I have added, I have 60,000 users and it ran and added 268 rows, it did not show any errors or anything, it just didnt add the rest and I have no idea why?

    <?PHP
require_once "../config/functions.inc.php";

// get users
$sql = 'SELECT * FROM  friend_login';
$result = executequery($sql);   
while($row = mysql_fetch_assoc($result)){
    // get states
    $sql = 'SELECT * FROM  usstates order by rand() limit 1';
    $state = getSingleResult($sql);
    //convert to lat and long
    $geo = get_geo($state);
    $lat = $geo['Latitude'];
    $long = $geo['Longitude'];

    //insert lat/long into locations table
    $insert = "INSERT INTO friend_location (user_id, lat, `long`) VALUES ('$row[auto_id]', '$lat', '$long')";
    executeQuery($insert);

    echo 'user updated with ' .$state. ' <BR> userID=' .$row[auto_id]. ' <BR><BR><BR>';
}
?>

try setting the maximum script execution time to 0 (infinite):

ini_set('max_execution_time', 0);

If you have display_errors or error_reporting turned off, then you may not see a fatal error generated by a timeout.