I have a problem. I am not very good at this. :) Let's say this is the DB anna_subscribers and i want to copy this database everytime i call this .php file to DB anna_newsletter. How can i edit this code so that it will not download the file but copy the database to another database on this server? This is the code of this file that executes the download:
<?
require_once('../../../../../initialize.php');
if(!$session->isLogedIn()) {
exit;
}
ini_set('memory_limit','16M');
$q=$db->get($db->query('SELECT sqlUrl, sqlDatabase, sqlUserName, sqlPassword, ID, importShopID, lastOrderUpdate FROM com_som_shops WHERE ID="3"'));
$dbhandle = new Database(false);
$dbhandle->open_connection(''.$q['sqlUrl'].'', ''.$crypt->decrypt($q['sqlUserName']).'', ''.$crypt->decrypt($q['sqlPassword']).'', ''.$crypt->decrypt($q['sqlDatabase']).'');
$dbhandle->query("SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'");
$db_un_chQ = $dbhandle->query("SELECT * FROM newsletter_subscriber WHERE subscriber_status='1' AND store_id='3' AND customer_id='0'");
$string="";
while($db_un_chR=$dbhandle->fetch($db_un_chQ)) {
$string.= $db_un_chR["subscriber_email"].",\n";
}
$dbhandle->close_connection();
header("Content-Type: text/plain; charset=utf-8");
header('Content-Disposition: attachment; filename="exportSubscrtiptionKondomanija_'.date("d.m.Y-H.i").'.txt"');
echo $string;
?>
Do i change ti with something like this:
INSERT INTO anna_newsletter..subscribers
SELECT * FROM anna_subscribers..subscribers
DB Structure: anna_subscribers has:
`ID``email``date_added`
DB Structure: anna_newsletter has:
`id``userID``email``custom_fields``list``unsubscribed``bounced``bounce_soft``complaint``last_campaing``last_ares``timestamp``join_date``confirmed``messageID`