11-06-2008, 02:11 AM
|
#2 (permalink)
|
|
The Contributor
Join Date: Nov 2008
Location: Norway
Posts: 58
Thanks: 20
|
Your original query was not working, thou it was only some minor mistakes that caused it to fail. I suggest you take a look at the MySQL Reference on the INSERT syntax.
The following code should work, but note that I have not tested it myself. It will first attempt to copy all records from the table`online_report` to the table `call_in`. Then it will return one message; one for success (if affected rows is higher than 0) or one for failure.
PHP Code:
<?php
// We insert the entire online_report table to call_in // Both tables MUST have the exact same structure, or this query will have to be changed $query = mysql_query( 'INSERT `call_in` SELECT * FROM `online_report`' );
// Continue if query succeded if( mysql_affected_rows( $query ) > 0 ) { echo '<p>The database was copied!</p>'; }
// Something failed else { echo '<p>The database was not copied!</p>'; }
?>
Please let me know if it works!
Yours,
Runar
Last edited by Runar : 11-06-2008 at 02:12 AM.
Reason: A small typo
|
|
|