"Sims" <siminfrance@hotmail.com> wrote in message
news:c3eh94$27gpc9$1@ID-162430.news.uni-berlin.de...[color=blue]
> Hi,
>
> Assuming the table MYTABLE, i want to run a script to backup the table.
> But there does not seem to be a straight forward function in MySQL to
> achieve it,
>
> Something like
> COPY TABLE MYTABLE, bkpMYTABLE;
>
> What would be the easiest way to do that using php?
>
> I know that i can create a table bkpMYTABLE and INSERT the data from[/color]
MYTABLE[color=blue]
> to bkpMYTABLE but the problem is that i will be using the script to run
> updates so i will not always know the structure of the data that the user[/color]
is[color=blue]
> copying, (because the script(s) will be precisely used to update the
> structure of the table).
>
> Maybe there is a function to retrieve the current structure and then copy
> the data?
>
> Also is there a way of testing if a table exists? and to test if a field
> within that table exists?
>
> Many thanks
>
> Simon[/color]
How about doing a dump of the database or table? It's safer than just
replicating the table.
http://www.mysql.com/doc/en/mysqldump.html
shell> mysqldump [options] database [tables]
OR mysqldump [options] --databases [options] DB1 [DB2 DB3...]
OR mysqldump [options] --all-databases [options]Then zip and copy it
somewhere safe or mail it to yourself.I do something similar with all our
clients postgres databases using cron and wget.--
Andrew @ Rockface
np: [winamp not running]
andrew@rockface-records.co.uk www.rockface-records.co.uk