<?php

// CONEXION Y VARIABLES
date_default_timezone_set('America/Costa_Rica');
$c = oci_connect("ge", "ge", "MATCH");
$titulo = $_POST['titulo_evento'];
$lugar = $_POST['lugar_evento'];
$ciudad = intval($_POST['combo_CIUDAD']);
$to = strtotime($_POST['fecha_evento']);
$fecha = date('d/m/y', strtotime($_POST['fecha_evento']));
$hora = $_POST['hora_evento'];
$descripcion = $_POST['descripcion'];
$result = $_POST['taskOption'];
$result_explode = explode('|', $result);
// Insertar Datos
$query = OCI_Parse($c, "insert into EVENTO (EVENTO_ID,NOMBRE, LUGAR, DESCRIPCION, FECHA, HORA) values (incremento_evento.nextval, :para2, :para3, :para4, :para5, :para6)");
OCI_Bind_By_Name($query, ":para2", $titulo);
//Ligar los parámetros oracle con variables de PHP
OCI_Bind_By_Name($query, ":para3", $lugar);
OCI_Bind_By_Name($query, ":para4", $descripcion);
OCI_Bind_By_Name($query, ":para5", $fecha);
OCI_Bind_By_Name($query, ":para6", $hora);
//Ejecutar la sentencia para insertar
$r = OCI_Execute($query);
OCI_Free_Statement($query);
//Liberar sentencia
echo $selectOption;
echo "<br>";
echo $to;
echo gettype($to);
echo gettype($titulo);
 /**
 +----------------------------------------------------------
 * 执行语句 针对 INSERT, UPDATE 以及DELETE
 +----------------------------------------------------------
 * @access protected 
 +----------------------------------------------------------
 * @param string $str  sql指令
 +----------------------------------------------------------
 * @return integer
 +----------------------------------------------------------
 * @throws ThinkExecption
 +----------------------------------------------------------
 */
 protected function _execute($str = '')
 {
     $this->initConnect(true);
     if (!$this->_linkID) {
         return false;
     }
     if ($str != '') {
         $this->queryStr = $str;
     }
     if ($this->autoCommit) {
         //释放前次的查询结果
         if ($this->queryID) {
             $this->free();
         }
     }
     $this->escape_string($this->queryStr);
     $this->writeTimes++;
     $this->W(1);
     $result = OCI_Parse($this->_linkID, $this->queryStr);
     $this->debug();
     if (!$result) {
         //throw_exception($this->error());
         return false;
     } else {
         if (!$this->autoCommit && $this->isMainIps($this->queryStr)) {
             $result = OCI_Execute($this->queryID, OCI_DEFAULT);
             $this->transTimes++;
         } else {
             $result = OCI_Execute($this->queryID, OCI_COMMIT_ON_SUCCESS);
         }
         if (false === $result) {
             //throw_exception($this->error());
             return false;
         }
         $this->numRows = oci_num_rows($this->_linkID);
         return $this->numRows;
     }
 }