tapius1 Posted July 15, 2009 Share Posted July 15, 2009 I need help with some code, im connecting to two databases on different machines and would like to run a query in which i fetch values from one db table and insert them into another using a primary key to identify what goes where. The code runs but the query doesn't every insert the values. Maybe someone could help me out. I'm moving a TON of data, 30,000 records per day, for a total for 3 months.. im trying to just accomplish 1 day at a time.. also phpED stopped query execution after 300 seconds, i wanted to know if this is a limit in php or just my IDE. anyway heres my code, tell me if theres something wrong with my insertion statement <?php //connect to VOICE RECORDING DATABASE $conn = odbc_connect("dsn1","user","pass"); mysql_selectdb("dsn1"); if ($conn) { echo "Connection 1 succeeded.<br />"; //connect to second database $conn2 = odbc_connect("dsn2","root","pass"); //mysql_select_db("dsn2"); if ($conn2) { echo "Connection 2 succeeded.<br />"; //initiate SQL query to second database connection .....date mmddyyyy $query2 = "SELECT * FROM rec_playint WHERE call_date = '07092009'"; //query to first database connection $query = "SELECT * FROM mysql.dsn1"; //return result sets numresults, and numresults2 for each of the queries $numresults = odbc_exec($conn, $query); $numresults2 = odbc_exec($conn2, $query2); //echo the results in a while loop // while($row = odbc_fetch_array($numresults2)) //{ // echo "{$row['call_date']}<br />" . // "{$row['call_time']}<br />" . // "{$row['tsr']}<br><br />"; // //echo the result for the other database // $row2 = odbc_fetch_array($numresults); // echo "{$row2['NobleCallID']}<br><br />"; //} while($row = odbc_fetch_array($numresults2)) { //while fetching arrays in connection 2 (dsn2 - NOBLE) insert into the $row2 Voice Recording Table $query = "INSERT INTO mysql.dsn1 (RecDate, RecTime, AgentID) VALUES ({$row['call_date']},{$row['call_time']}, {$row['tsr']}) WHERE NobleCallID = {$row['file_num']} "; echo "{$row['call_date']} " . "{$row['call_time']} " . "{$row['tsr']}" . "{$row['file_num']}"; } echo "finished"; odbc_close($conn); odbc_close($conn2); echo "both connections have been closed"; } else { echo "Connection failed.<br />"; echo odbc_errormsg(); } } ?> Link to comment https://forums.phpfreaks.com/topic/166079-informix-mysql-migration-engine/ Share on other sites More sharing options...
fenway Posted July 18, 2009 Share Posted July 18, 2009 You can try using multi-valued INSERT statements... but yes, php has a max execution time. Link to comment https://forums.phpfreaks.com/topic/166079-informix-mysql-migration-engine/#findComment-877694 Share on other sites More sharing options...
rs.shadow0000 Posted August 5, 2009 Share Posted August 5, 2009 Maybe anyone could advice me out. I'm affective a TON of data, 30,000 annal per day, for a absolute for 3 months.. im aggravating to just achieve 1 day at a time.. aswell phpED chock-full concern beheading afterwards 300 seconds, i capital to apperceive if this is a absolute in php or just my IDE. _________________ Business process automation Link to comment https://forums.phpfreaks.com/topic/166079-informix-mysql-migration-engine/#findComment-891272 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.