Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 23rd, 2010, 10:32 PM
klox klox is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2010
Posts: 4 klox User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 10 m 25 sec
Reputation Power: 0
Exclamation How to insert data to MYSQL after get data from Firebird

i have two different DB: MYSQL and Firebird.

what i want to do is after i get data from Firebird, i can do two jobs:

1. get data from FB then show data use jquery datatable
2. after get data from FB, i can insert the data into mysql table.

but i just can do the `no.1`, it can works properly(no problem with this):

Code:
define("DBNAME","xx.xxx.xx.xxx:D:\DATABASE\OCS DATA.FDB"); // data bsse name
    define("DBUSER","USER"); // user name
    define("DBPASS","USER"); // password
    
    // DB connection
    $dbh = ibase_connect(DBNAME,DBUSER,DBPASS) or die(_ERROR15.": ".ibase_errmsg());
    
    $sQuery = "SELECT ".$sLimit." LINE_NAME, MODEL_ONLY, VER_ONLY, PROD_NO, 
                                      LOT_SIZE, START_SERIAL, SERIAL_NO_LOW, SERIAL_NO_UP, PROD_DATE 
                               FROM DOC_TO".$sWhere.$sOrder.";";
            }
    
    $rResult = ibase_query( $sQuery) or _doError(_ERROR30 . ' (<small>' . htmlspecialchars($sql) . '</small>): ' . ibase_errmsg() );

    .......datatable serverside script
    ibase_free_result($rResult);


but after i want to do `step 2`, i got interval server error:

Code:
//put this code after $rResult
    
        while ($ibase_row = ibase_fetch_assoc($rResult))
                {
                        $ins = array();
                        foreach ($ibase_row as $col => $val)
                        {
                                $ins[$col] = mysql_real_escape_string($val);
                                }
        
                        $dbc=mysql_connect(_SRV, _ACCID, _PWD) or die(_ERROR15.": ".mysql_error());
                        mysql_select_db("qdbase") or die(_ERROR17.": ".mysql_error());
        
                        $mysql_insert = "INSERT INTO `ALL` SET ".implode(',', $ins);
                        mysql_query($mysql_insert, $dbc) or _doError(_ERROR30 . ' (<small>' . htmlspecialchars($sql) . '</small>): ' . mysql_error() );
                        }

can you show me the correct answer for this? it seems like do insert after select method.or select data then insert to another table.

Reply With Quote
  #2  
Old November 24th, 2010, 08:25 PM
klox klox is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2010
Posts: 4 klox User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 10 m 25 sec
Reputation Power: 0
i got this error:
Code:
Access denied for user 'www-data'@'localhost' (using password: NO)

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > How to insert data to MYSQL after get data from Firebird

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap