You are here: Re: How do I copy a table for backup and restore purposes « PHP SQL « IT news, forums, messages
Re: How do I copy a table for backup and restore purposes

Posted by Tom on 11/23/07 18:52

On Thu, 22 Nov 2007 20:31:43 +0100, Flemming wrote...
>
>Hi there,
>
>I have a small database running in mySQL on a web-hotel. I use PHP to access
>the database.
>
>Unfortunately, the web-hotel does not offer any possibilities for backing up
>databases/tables, other than copying the tables manually one by one using
>the facilities of phpMyAdmin.
>
>What I would ideally like to have is a PHP routine that that makes an exact
>copy of a specified table. I could then easily use that to createl copies of
>all the relevant tables in the database.
>
>I thought this would be a relatively easy task, but this does not appear to
>be the case. Or maybe I am blind. I can see in phpMyAdmin the SQL statements
>needed to create a new empty table and copy the content from the original
>table. I could of course copy this code into PHP, but what then if I change
>a table? Then I need to change this code as well.
>
>Is there a smarter way?
>
>Flemming
>


I'd run a separate command to create your new table, then use

SELECT * INTO NewTable FROM OldTable;

Of course I'd do a regular backup of your entire database first, just for
precautionary measures.

Tom
--
NewsGuy Accounts Go Jumbo!
NewsGuy Express increased from 30 to 50 GB of download capacity
http://newsguy.com/overview.htm

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация