#Connect to production database and results copy into test #database and update the data my $table_results= $dbh2->prepare("SELECT * from $feed_table WHERE entry_time >= $time"); $table_results->execute(); while(my @results = $table_results->fetchrow_array()) { if(@results) { ##prints out results that should be copied to test database foreach(@results) { print "$_\n"; } } else { print "There is no data for this selected time\n"; } } ##Connect to the test feed database instance and insert data my $destination_host="destination"; my $destination_dsn =DBI:mysql:database=$dbrow;host=$destination_host"; my $destination_user="root"; my $destination_pass="ol^16"; my $dbh3 = DBI->connect( $from_feed_dsn, $from_feed_user, $from_feed_pass, { RaiseError => 1 }) or die ( "Couldn't connect to database: " . DBI->errstr ); my $sth_insert = $dbh3->prepare("insert into $feed_table (id_code,entry_time,parent_id_code,author_name,author_code,author_url,author_image_url,entry_url,entry_types, status_code,entry_text,entry_data,last_update,pull_time,queue_code) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) "); while (my $insert = $table_results->fetchrow_array()) { $sth_insert->execute(@$insert);