Jump to content

Move selected fields from one mysql table to another


thomo03

Recommended Posts

Hi guys...I'm having trouble!!

 

I can manage to move ALL my table data from one table to another, however I want to move only SELECT data, for stats, and delete the other data which is sensitive.

 

I have included a picture of the table set-up.

 

I have also sorted out a seperate include file for the database connection, so that isn't an issue, it just seems to be my code.

 

When I execute the file, my error is returned as nvalid query: Operand should contain 1 column(s)

 

The current PHP I have is

 

<?php
if(!isset($_POST['id']))
    header("Location: ".$_SERVER['HTTP_REFERER']); 
require_once('config.inc.php');
require_once('common.inc.php');
require_once('connection.inc.php');
$ids        = implode(',',$_POST['id']);
$queryInsert= "INSERT INTO $dest_table (id, date) (SELECT (id, date) FROM $src_table WHERE id IN ($ids))";
$queryDelete= "DELETE FROM $src_table WHERE id IN ($ids)";
if(!mysql_query($queryInsert))
die('Invalid query: ' . mysql_error());
if(!mysql_query($queryDelete))
die('Invalid query: ' . mysql_error());
header("Location: ".$_SERVER['HTTP_REFERER']);  
?>

 

 

Please help guys.

 

Thank you in advance

 

[attachment deleted by admin]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.