Troubles with PostgreSQL

#1
[eluser]hrundel[/eluser]
Hi, all. I'm not long ago begin to use CodeIgniter, it's nice and light for understanding framework.
But when I face to some troubles when I try to work with postgresql.
I edited database.php as needed and when loading database library thereis no errors i.e. connecting and selecting database passed successfully, but such construction
Code:
$query = $this->db->query("SELECT * FROM some_table");
echo "<pre>";
var_dump($query);
echo "</pre>";
return empty result_array, although some_table not empty. I'm use latest version of codeigniter and version of postgresql sever is 8.0
Doe's enybody know reason of my trouble.
Thanks.

#2
[eluser]optimal[/eluser]
You may have already verified this, but does your database user (Postgres role) definitely have the necessary select privileges for your table? Can your specified user select from this table outside of PHP/CI?

#3
[eluser]hrundel[/eluser]
Quote:Can your specified user select from this table outside of PHP/CI?
Yes, I run such select query from pgAdmin where I connected to postgres server using the same user as in CI. And pgadmin sql window show results of such query i.e. my table is not empty.

#4
[eluser]optimal[/eluser]
You could also try creating a simple test page to see if you can retrieve your query results using PHP without the CI framework (if only to eliminate that as a potential source of the problem).

#5
[eluser]hrundel[/eluser]
Problem solved, thanks all.
var_dump($query) showed that result is empty, but $query->num_rows() worked. And following construction also worked:
foreach($query->result() as $row)
echo $row->field_name


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.