Hi All,
I have a problem with Codeigniter connectiong to SQL Server 2012. Below my database Configuration
$db['DbSms'] = array(
'dsn' => '',
'hostname' => 'Driver={SQL Server};Server=My Local IP',
'username' => 'sa',
'password' => 'my password',
'database' => 'DB_SMS',
'dbdriver' => 'odbc',
'dbprefix' => '',
'pconnect' => TRUE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
Below my script in controller
$correct_ip_address = $_SERVER['REMOTE_ADDR'];
$query = $this->dbuser->query("
select * from [USERMASTER].[dbo].[tbl_trx_session]
where USER_ID ='$USER_ID' AND SESSION_LOGINFLAG='1' AND SESSION_WKIP='$correct_ip_address'
");
foreach ($query->result() as $row){
echo $row->USER_ID;
echo $row->USER_ID;
echo $row->USER_ID;
}
print_r($query);die;
Result print_r
CI_DB_odbc_result Object ( [conn_id] => Resource id #53 [result_id] => Resource id #54 [result_array] => Array ( ) [result_object] => Array ( [0] => stdClass Object ( [IDX] => 421567 [USER_ID] => opsup4 [APP_ID] => Aplikasi RSS [SESSION_WKID] => [SESSION_WKIP] => 10.20.34.73 [SESSION_STARTLOGIN] => 2016-01-12 09:43:41.000 [SESSION_ENDLOGIN] => [SESSION_LOGINFLAG] => 1 [SESSION_TRXDATE] => [SESSION_CLOSEBY] => ) ) [custom_result_object] => Array ( ) [current_row] => 0 [num_rows] => [row_data] => )
Any body know why
[row_data] is null although there is not null with my query result
Thank's