#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2010
    Posts
    4
    Rep 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.
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2010
    Posts
    4
    Rep Power
    0
    i got this error:
    Code:
    Access denied for user 'www-data'@'localhost' (using password: NO)

IMN logo majestic logo threadwatch logo seochat tools logo