PDA

View Full Version : How to move a record from one table to another?


Saw
09-26-2008, 12:38 PM
I have 2 tables, `index` & `deleted`.

I have a dynamic table that lists the contents of table `index`.

I have added a column and placed a link in the column that sends the record id as a URL parameter to page moverecord.php.

- I am not sure how to design the page moverecord.php.
What I want is for the record selected (from table index) to be inserted into (table deleted), then I want the record to be deleted from table index.

I am very novice so any examples or help would be most appreciated...
thanks in advance for looking

edbr
09-27-2008, 03:17 AM
my 2 cents:
make a select statement to fetch the record, this will give you (ie) $row['field1'];$row['field2']; etc.
nect make an insert statement field 1 = $row['field1'],field2 = $row['field2'],etc
then a delete statement from the original table

Saw
09-28-2008, 10:41 AM
thanks, I had already fixed the problem by the time I read your post...but thank you for taking the time to help.

Once I moved my thinking away from trying to do it all in once step on one page it just fell into place.