Reputation: 141
I have this query, thrown by the debug codeigniter
A Database Error Occurred
Error Number:
INSERT INTO "SALUD"."POS_EMPLEOS" ("EMPLEO_EST_ID", "EMP_FECHA_PUBLICACION", "EMP_FECHA_FINALIZA", "EMP_DESCRIPCION", "EMP_VACANTES", "EMP_EXP_MINIMA", "CARGO_TIPO_ID", "AREA_PROFESIONAL_AREA_ID", "CALIDAD_JURIDICA_CAL_ID", "EST_CODIGO", "EMP_TITULO") VALUES ('1', '17/02/2015', '28/02/2015', 'Programador PL/SQL Oracle', '1', '6 Anos', '2', '12', '1', '100', 'Database Analyst')
Filename: C:\Program Files\EasyPHP-DevServer-14.1VC11\data\localweb\projects\recluta-igniter\system\database\DB_driver.php
Line Number: 331
controller:
public function grabar_convocatoria(){
$titulo = $this->input->post("titulo_oferta");
$descripcion = $this->input->post("descripcion");
$fecha_finaliza = $this->input->post("fecha_finaliza");
$vacantes = $this->input->post("vacantes");
$experiencia = $this->input->post("sel_experiencia");
$tipo_cargo = $this->input->post("sel_tipo_cargo");
$area_prof = $this->input->post("sel_area_prof");
$calidad_j = $this->input->post("sel_cal_jur");
$establecimiento= "$this->cod_estab";
$resultado = $this->model_empleos->set_empleo($titulo,$descripcion,
$fecha_finaliza,$vacantes,
$experiencia,$tipo_cargo,
$area_prof,$calidad_j,
$establecimiento);
if($resultado){
redirect("ctrl_editor/publicar_convocatoria");
}else{
$datax["data"] = $resultado;
$this->load->view("view_test",$datax);
}
}
Model:
public function set_empleo($titulo,$descripcion,$fecha_finaliza,$vacantes,
$experiencia,$tipo_cargo,$area_prof,$calidad_j,
$establecimiento){
$data = array(
'EMP_FECHA_PUBLICACION' => '17/02/2015',
'EMP_FECHA_FINALIZA' => $fecha_finaliza,
'EMP_DESCRIPCION' => $descripcion,
'EMP_VACANTES' => $vacantes,
'EMP_EXP_MINIMA' => $experiencia,
'CARGO_TIPO_ID' => $tipo_cargo,
'AREA_PROFESIONAL_AREA_ID' => $area_prof,
'CALIDAD_JURIDICA_CAL_ID' => $calidad_j,
'EST_CODIGO' => $establecimiento,
'EMP_TITULO' => $titulo
);
$this->db->set("EMPLEO_EST_ID",'1');
$this->db->insert("SALUD.POS_EMPLEOS",$data,FALSE);
if($this->db->affected_rows() == 1)
{
return true;
}
else
{
return $this->db->last_query();
}
}
I have tried multiple ways to make the insert. in my project there are many inserts, only this is what gives problems.
Please Help me!
//***** edit *** //
Solution : TO_CHAR(FIELD,'dd/mm/yyyy') AS DATE
Upvotes: 1
Views: 1301
Reputation: 3008
Your dates are not formated correctly
Convert them in US format :
$timestamp = '20/02/2015';
$timestamp = date_create_from_format('d/m/Y', $timestamp);
$gooddate = date_format($timestamp, 'Y-m-d');
Upvotes: 1