Buenas, necesitaria q algun monstruo de php me ayude a corregir en donde esta mal puesto mi codigo ya que estoy queriendo insertar una fila en la base de datos y no esta comprendiendo cuando le digo que inserte el valor de la variable $fechaok; .
A los otros datos los estoy tomando de mas abajo de mi pagina y estan en campos de input y selects.
Muchas Gracias
G
Código PHP:
<?php require_once('../Connections/bd_empresas.php');
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$tiempo_de_alta =1;
$fechaok = date( "YmdHis",mktime(date("H"),date("i"),date("s"),date("m"),date("d")+$tiempo_de_alta,date("Y")));
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO clasificados (id_rubro, provincia, localidad, titulo, destacado, descripcion, cantidad, precio, estado, fecha, id_usuario, visitas) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['id_rubro'], "text"),
GetSQLValueString($_POST['provincia'], "text"),
GetSQLValueString($_POST['localidad'], "text"),
GetSQLValueString($_POST['titulo'], "text"),
GetSQLValueString($_POST['destacado'], "text"),
GetSQLValueString($_POST['descripcion'], "text"),
GetSQLValueString($_POST['cantidad'], "text"),
GetSQLValueString($_POST['precio'], "int"),
GetSQLValueString($_POST['estado'], "int"),
GetSQLValueString($fechaok, "date"), // <--- aqui el error ( CREO )
GetSQLValueString($_POST['id_usuario'], "text"),
GetSQLValueString($_POST['visitas'], "text"));