Insert post in postgresql


#1

I can see in a correct way the data that the database gives me the problem is that I can not insert them from ionic.

code igniter

controllers

[details=Summary]<?php
defined(‘BASEPATH’) OR exit(‘No direct script access allowed’);

class news extends CI_Controller {
function __construct() {
parent::__construct();
}
public function index()
{
$id = $_POST [‘id’];
$nombre = $_POST[‘nombre’];
$apellido= $_POST[‘apellido’];
$password= $_POST[‘password’];
$fecha_nac= $_POST[‘fecha_nac’];
$correo_electronico= $_POST[‘correo_electronico’];
$numero_de_telefono = $_POST[‘numero_de_telefono’];
$fecha_nac = $_POST[‘fecha_nac’];
$this->load->model(‘news_model’);
$modelo = $this->news_model->insertar($id, $nombre, $apellido, $password, $fecha_nac, $correo_electronico, $numero_de_telefono);
$this->redireccion(‘http://localhost:8100/#/app/comunidadall’);
}
public function redireccion ($url){
header (“Location: $url”);
}
}
[/details]

model

[details=Summary]<?php
class news_model extends CI_Model{

public function insertar ($id, $nombre, $apellido, $password, $fecha_nac, $correo_electronico, $numero_de_telefono){
    $q = $this->db->query("INSERT INTO user (id, nombre, apellido, password, fecha_nac, correo_electronico, numero_de_telefono) VALUES ('$id', '$nombre', '$apellido', '$password', '$fecha_nac', '$correo_electronico', '$numero_de_telefono' )");
}

}

bd


#2

I’m not seeing how Ionic is involved here.