Reply
Take data out of one dB and Insert it into another
Old 10-26-2004, 12:59 PM Take data out of one dB and Insert it into another
bman's Avatar
Skilled Talker

Posts: 85
Location: USA
Is this the proper logic (suedo code) for what I am trying to do?

I want to Take the data out of one dB and Insert it into another. All the fields match in both dBs I am trying to write a script that will perform the task. The structure of the dB that I am copying information from, has a field that is marked transferred or not. "1" stands for not transferred, and is default. "0" is transferred.

Will my code logic work?
If loop checks for record marked with a "1" in the transfer field;

If "no" redirect to main menu page;

If "yes" it copies all the values of the record into a array;

Inserts new value of "0" in the transfer field;

Closes the dB connection;

Converts the values in the array to variables ;

Opens a connection to the dB I want information transferred to;

Inserts the variables into the dB as a new record;

Close loop;

Then performs this action again until all records are transferred.
bman is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 10-26-2004, 03:29 PM
Average Talker

Posts: 18
heres how I would do it :

open dbase1
open dbase2

select all records from dbase 1 where transfer = 1

loop records
insert record into dbase2
end loop

close dbase2
close dbase1

-----------

I assume you are using mysql, and you can select and insert at the same time I think...cant quite remember the syntax, but that would take out some of the steps above.
Steb is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Take data out of one dB and Insert it into another
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Webmaster Resources Marketplace:
Software Development Company | Webhosting.UK.com | Text Link Brokers 


   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.46240 seconds with 12 queries