bnovak Posted June 13, 2010 Share Posted June 13, 2010 Ok, lemme see if I can explain this so it makes some sense. It should be pretty simple - I can copy the tables INSIDE the db, but I have two db's that I need to copy a series of table columns between. Basically, I have two different frameworks on my site, one is a member application, and the second is a link directory. I want to copy the username and password from the member system to the linkdirectory system when a new user registers for a membership, but NOT vice-versa. Public can still register for the link directory though......(this way members only have one unified login and password across the site, make sense?) These are on the same server I'm basically trying to do a $query = "INSERT INTO table2 (colA,colB,) SELECT colA,ColB FROM table1 "; which works if they are in the same db, but I don't know the trick is to go to another db. Since this table is auto-increment, I'm also assuming that I can ignore the PK field and it will set one automatically? Also, what would be the trick so that when this runs (I'll just put it in with some other php code I have on user update to the profile) it checks to make sure that it's not duplicating entries? Quote Link to comment https://forums.phpfreaks.com/topic/204654-copy-table-columns-from-one-db-to-another-2-parts/ Share on other sites More sharing options...
ignace Posted June 13, 2010 Share Posted June 13, 2010 this way members only have one unified login and password across the site, make sense? Never thought about creating a shared database? Or make the second application work with the database of the first? which works if they are in the same db, but I don't know the trick is to go to another db. Documentation enlights the mind. $query = "INSERT INTO database1.table2 (colA,colB,) SELECT colA,ColB FROM database2.table1 "; Quote Link to comment https://forums.phpfreaks.com/topic/204654-copy-table-columns-from-one-db-to-another-2-parts/#findComment-1071499 Share on other sites More sharing options...
bnovak Posted June 13, 2010 Author Share Posted June 13, 2010 Perfect - thanks ignace. I have thought about creating a shared DB and will most likely go that route in the future for sanity's sake. This one is more of the "learning experience" though, and I haven't learned enough about joining two different software packages to one db. Thanks again for the help. Quote Link to comment https://forums.phpfreaks.com/topic/204654-copy-table-columns-from-one-db-to-another-2-parts/#findComment-1071621 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.