Set_time_limit (0); The timeout is set to 0, which indicates that it has been executed. When PHP is invalid in safe Mode mode, this may cause the import timeout, which requires a segmented import $db = new MySQL ($location [' Host '], $location [' hostname '], $location [' Hostpass '], $location [' table '], ' UTF8 ', $location [' Ztime ']); $fp = @fopen ($sql, "R") or Die ("Cannot open SQL file $sql");/Open File while ($sql =getnextsql ()) { mysql_query ($sql); } echo "User data import complete!"; Fclose ($fp) or Die ("can ' t close file $file _name"); Take SQL from a file function Getnextsql () { Global $fp; $sql = ""; while ($line = @fgets ($fp, 40960)) { $line = Trim ($line); The following three sentences are not required in a high version of PHP and may need to be modified in some low versions $line = Str_replace ("\", "\", $line); $line = Str_replace ("'", "'", $line); $line = Str_replace ("\ r \ n", Chr. Chr (a), $line); $line = Stripcslashes ($line); if (strlen ($line) >1) { if ($line [0]== "-" && $line [1]== "-") { Continue } } $sql. = $line. chr. chr (10); if (strlen ($line) >0) { if ($line [strlen ($line) -1]== ";") { Break } } } return $sql; } ?> |