thomo03 Posted October 2, 2010 Share Posted October 2, 2010 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] Quote Link to comment https://forums.phpfreaks.com/topic/215004-move-selected-fields-from-one-mysql-table-to-another/ Share on other sites More sharing options...
BlueSkyIS Posted October 2, 2010 Share Posted October 2, 2010 which of the queries is invalid, and what does it look like when it is executed? mysql_query($sql) or die(mysql_error() . " IN $sql"); Quote Link to comment https://forums.phpfreaks.com/topic/215004-move-selected-fields-from-one-mysql-table-to-another/#findComment-1118403 Share on other sites More sharing options...
thomo03 Posted October 2, 2010 Author Share Posted October 2, 2010 Query was empty IN Does that make sense? Thank you? Quote Link to comment https://forums.phpfreaks.com/topic/215004-move-selected-fields-from-one-mysql-table-to-another/#findComment-1118409 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.