PDA

View Full Version : MySQL > Switching data



Hitman
26-06-2007, 11:32 AM
Hey, well, I have a database which has 2 tables:

1 - newinfo
2 - archive

I want to be able to press a link, then whatever I choose from the newinfo goes into the archive.

All I need is a code that can switch data in the database to another table.

So I'd press "Put it in the Archive", it'd then be deleted from newinfo and be put into archive.

Thanks. :)

timROGERS
26-06-2007, 12:28 PM
Just do it by getting the data from the newinfo table, putting it into the archive table and then delete the old data from newinfo. It may be a long method, but as far as I know it's the only way.

Hitman
26-06-2007, 01:02 PM
Thanks dude :) I'm not great with MySQL, anybody know the code :P

Mentor
26-06-2007, 02:58 PM
Well, first off, loop out all the newinfo table in to an array of data, then do another loop and put the data from the array in to the archive table.
then just set sql to blank to old new info table "/

Luckyrare
26-06-2007, 03:14 PM
Its pretty easy to do this, take a look at a few of these functions

www.php.net/while
www.php.net/mysql_query
www.php.net/mysql_fetch_array

Want to hide these adverts? Register an account for free!