Hi, I’m having problems getting data from a second database running on a sub-domain on the same web server.
My config:
‘dbnew’=>array(
'connectionString' => 'mysql:host=localhost;dbname=dbnew',
'emulatePrepare' => true,
'username' => 'admin',
'password' => 'password',
'charset' => 'utf8',
'enableProfiling' => false,
'enableParamLogging' => true,
),
‘dbold’=>array(
'connectionString' => 'mysql:host=localhost;dbname=dbold',
'emulatePrepare' => true,
'username' => 'admin',
'password' => 'password',
'charset' => 'utf8',
'enableProfiling' => false,
'enableParamLogging' => true,
'class' => 'CDbConnection',
),
I am trying to import new/changed products from dbold into a slightly new structure in dbnew.
dbold.products has 235 rows
When I run:
$oldproducts = Yii::app()->dbold->createCommand(‘SELECT id FROM products ORDER BY id ASC’)->queryAll();
echo count($oldproducts) . ’ products <br />’;
I get only 57 rows.
If I import the database table into dbnew and then run:
$products = Yii::app()->dbnew->createCommand(‘SELECT id FROM products ORDER BY id ASC’)->queryAll();
echo count($products) . ’ products <br />’;
I get all 235 rows?
Anyone have an idea of what’s going on here?