[eluser]ELRafael[/eluser]
Hello everybody...
I'm with a strange behavior in CodeIgniter 1.7.1 (From SVN and the official release from Website).
Using Wamp server with PHP 5.2.9 under Windows Vista SP1, but tested in Linux plataform, with the same php version and the issue was the same.
The application must have a second database connection to retrieve data.
What I've done:
- Configured database.php with another group, called 'sqlserver'. This group isn't the default.
- Created another model, called
mssql_model.php. Inside it, I load the second group configuration
Code:
function get()
{
$sqlserver = $this->load->database('sqlserver', TRUE);
$query = $sqlserver->get('table_name');
return $query;
}
- In controller, just the basic:
Code:
function products()
{
$this->load->model('mssql_model');
$data['products'] = $this->mssql_model->get();
$this->load->view('view_name', $data);
}
- In the view:
Code:
<?php foreach ($products->result() as $product) : ?>
Product ID: <?php echo $product->id; ?><br />
Another data: bla bla bla
<?php endforeach; ?>
All this work, ok. But creates a blank space in the begin of webpage (when I run in the browser). I noticed that this behavior is because the
TRUE inside the mssql_model.php
Code:
$sqlserver = $this->load->database('sqlserver', TRUE);
When I remove the TRUE, the blank space dissapear.
I also changed the second connection to a MySQL database, to check if the problem was the MS-SQLServer, but the issue stays :-S
I searched inside the CI Forum, but nothing founded about this.
I don't know if this is a bug, but seems to me.
Thanks,
Rafael