Welcome Guest, Not a member yet? Register   Sign In
Help with PostgreSQL
#1

[eluser]Gabriel Melo[/eluser]
Hello.

I'm trying to develop an application with Codeigniter 2.1.2 and Postgre 8.3 on Windows Xp. I work with Xampp 1.6.7, Apache/2.2.9, PHP/5.2.6.

Here's the database.php code:

Code:
$active_group = 'default';
$active_record = TRUE;

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'postgres';
$db['default']['password'] = 'password';
$db['default']['database'] = 'orfeo';
$db['default']['dbdriver'] = 'postgre';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;

I did a basic Model, Controller and view:

Code Model:

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Postgre_model extends CI_Model {

public function getMacroprocesos()
{
  $query = $this->db->select('macroproceso.nombre');
  $query = $this->db->get('macroproceso');
  return $this->query->result();
}
    

}

Controller code

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Test_postgre extends CI_Controller {

    public function index()
    {
      $this->load->model('Postgre_model');
      $data['macroprocesos'] = $this->Postgre_model->getMacroprocesos();
      $this->load->view('test-view', $data);
    }

}


and the view code:

Code:
<html>
<head>
<title>Test Postgre Codeigniter</title>
</head>
<body>
<?php foreach ($macroprocesos as $macroproceso): ?>
  echo $macroproceso->nombre;
<?php endforeach ?>
</body>
</html>


So, when I try to test the results in the browser via http://localhost/sgi/index.php/test_postgre the app shows me this error message:

Quote:A Database Error Occurred

Error Number:

ERROR: relation "macroproceso" does not exist

SELECT "macroproceso"."nombre" FROM "macroproceso"

Filename: D:\Dropbox\sgi\system\database\DB_driver.php

Line Number: 330


I don't know what is happening. It's my first project with Codeigniter and PostgreSQL.

Thanks for help me.

Gabo


Messages In This Thread
Help with PostgreSQL - by El Forum - 09-19-2012, 03:57 PM
Help with PostgreSQL - by El Forum - 09-21-2012, 03:03 PM
Help with PostgreSQL - by El Forum - 09-21-2012, 06:35 PM
Help with PostgreSQL - by El Forum - 09-21-2012, 11:08 PM
Help with PostgreSQL - by El Forum - 09-22-2012, 08:34 AM



Theme © iAndrew 2016 - Forum software by © MyBB