Re: Timeout problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks for your suggestion, i don't know how that would actually be done,
but still, I need to do this based on the selection done by the web user.
The interfase is pretty like the phpMyAdmin, only much simpler, the options
are to backup the entire database, just data or just structure.

"Jonathan Haddad" <jon@xxxxxxxxxxxxxxxxx> escribió en el mensaje
news:4113DABF.5010705@xxxxxxxxxxxxxxxxxxxx
> can you just use a cron job and mysqlbackup instead?   it does what you
> want and is already written.
>
> Jon
>
> Mauro Chojrin wrote:
>
> >Hi:
> >
> >  I'm developing a db application with php and I have this problem:
> >
> > I have a script for backup making which is very simple, it just goes
> >through the entire database creating a file which contains the sql
> >statements to re create the database. The first thing the script does y
> >increase the time limit based on a calculation over the total number of
> >records. Every time I ran the script it would time out. After some time
> >reviewing the code (First I thought it might be hanging in an infinite
loop)
> >I realized the problem was with a particular big size table. There must
be a
> >way to optimize the code, because when I backup the database through
> >phpMyAdmin it works just fine, even fast.
> >
> >This the cycle that's crashing down:
> >
> >$fields = mysql_list_fields($dPconfig['dbname'], $row[0]);
> >     $columns = mysql_num_fields($fields);
> >
> >     $insertSQL = 'INSERT INTO `'.$row[0].'` VALUES (';
> >
> >  // all data from table
> >  $result = mysql_query('SELECT * FROM '.$row[0]);
> >
> >  while($tablerow = mysql_fetch_array($result))
> >  {
> >   $output .= $insertSQL;
> >   for ($i = 0; $i < $columns; $i++)
> >   {
> >    // remove all enters from the field-string. MySql stamement must be
on
> >one line
> >    $value = str_replace("\r\n",'\n',$tablerow[$i]);
> >    // replace ' by \'
> >    $value = str_replace('\'',"\'",$value);
> >    $output .= '\''.$value.'\',';
> >   }
> >   $output = substr($output,0,-1); // remove last comma
> >   $output .= ');' . "\r\n";
> >  } // while
> >
> >  $output .= "\r\n";
> >  $output .= "\r\n";
> > }
> >
> >Thanks!
> >
> >
> >

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux