09-19-2012, 03:57 PM
[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:
I did a basic Model, Controller and view:
Code Model:
Controller code
and the view code:
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:
I don't know what is happening. It's my first project with Codeigniter and PostgreSQL.
Thanks for help me.
Gabo
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