Database Restore Problems...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Mr. Tech
Forum Contributor
Posts: 205
Joined: Tue Feb 11, 2003 4:18 pm
Location: Australia

Database Restore Problems...

Post by Mr. Tech »

I am trying to create a script that will backup and restore the tables. The backup part works fine it's just when I go to restore, it does a certain amount of rows and then cuts out. There must be about 1300 rows with a lot of information in each(Sort of like a phpbb form post)

I have added a @set_time_limit(0); at the top of the page but that doesn't do anything...

Here is my restore code:

Code: Select all

<?php
$dump = @file($_FILES['userfile']['tmp_name']);
@unlink($_FILES['userfile']['tmp_name']);
$count = count($dump);

for ($i=0 ;$i<$count ;$i++) {
if (!trim($dump[$i])) continue;
if (ereg("^#",$dump[$i])) continue;
$content = str_replace(";\n","\n",$dump[$i]);
mysql_query($content);
}
?>
Is there a way to stop it cutting out?
User avatar
Johnm
Forum Contributor
Posts: 344
Joined: Mon May 13, 2002 12:05 pm
Location: Michigan, USA
Contact:

Post by Johnm »

What db are you using first of all? Secondly, read the documentation for the db to see what and where the time limits for transactions are set to and where to change them. Also, the PHP parser has a setting in the PHP.ini file that limits the length of time that a script has to be executed. For example: I have a 60 second time limit set for transactions in my PHP.ini file but in the Informix db configuration file I have a time limit set to 180 seconds. The web server will time out before the db does so changing a setting in the db, in this case, will do me no good. Also, you must restart the web server (for the changes to take effect) after changing the php.ini file and the same goes for the db.


Hope that helps,
John M
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Mr. Tech
Forum Contributor
Posts: 205
Joined: Tue Feb 11, 2003 4:18 pm
Location: Australia

Post by Mr. Tech »

Hmmm... I'll try it :D
Post Reply