Welcome Guest, Not a member yet? Register   Sign In
Blank Space in load database
#1

[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: &lt;?php echo $product->id; ?&gt;<br />
  Another data: bla bla bla
&lt;?php endforeach; ?&gt;

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
#2

[eluser]ELRafael[/eluser]
First of all, I'm soo sorry about this. :red:

This is NOT a bug.

The file application/config/database.php (where the second group is) was in UTF8 in Encoding. I don't know why, but I needed to put UTF-8 Plain, or ANSI.

Problem solved, I don't know how to remove this post from Bug Forum.

Sorry again :down:




Theme © iAndrew 2016 - Forum software by © MyBB