I have two tables within the same database. Both tables have the same columns.
I would like to know how you can move the contents of a row from table 1 to table 2 by selecting a checkbox (that uses the IN clause)
I have attempted to search for the answer without success. Below is the code that I currently use. Just need to modify the code to make the selected items move its location from one table to another.
Please advise
<?
include("config.php");
$connection = mysql_connect("$server", "$db_user", "$db_pass");
$db = mysql_select_db("$database", $connection);
if($_POST["deleted_items"] != "")
{
$delItems = implode(",", $HTTP_POST_VARS['deleted_items']);
for($x=0;$x<count($delItems);$x++)
{
$query = "DELETE FROM $table_name_usermessages WHERE id IN ($delItems)";
$result = mysql_query($query, $connection) or die(mysql_error());
}
}
?>
I know there is a command in php/mysql for insert and delete, is there one for move?