Código PHP:
<?php require_once('Connections/tiendaConn.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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 productos (nombre_producto, titulo, categoria, record_label, protagonista, descripcion, formato, entrega, uso, precio, track_list, codigo_pedido, ano, video, imagen) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['nombre_producto'], "text"),
GetSQLValueString($_POST['titulo'], "text"),
GetSQLValueString($_POST['categoria'], "text"),
GetSQLValueString($_POST['record_label'], "text"),
GetSQLValueString($_POST['protagonista'], "text"),
GetSQLValueString($_POST['descripcion'], "text"),
GetSQLValueString($_POST['formato'], "text"),
GetSQLValueString($_POST['entrega'], "int"),
GetSQLValueString($_POST['uso'], "text"),
GetSQLValueString($_POST['precio'], "double"),
GetSQLValueString($_POST['track_list'], "text"),
GetSQLValueString($_POST['codigo_pedido'], "text"),
GetSQLValueString($_POST['ano'], "date"),
GetSQLValueString($_POST['imagen'], "text"), <---- //miren aqui quisiera convertir estas imagenes en upload
GetSQLValueString($_POST['imagen2'], "text")); <---- //miren aqui quisiera convertir estas imagenes en upload
mysql_select_db($database_tiendaConn, $tiendaConn);
$Result1 = mysql_query($insertSQL, $tiendaConn) or die(mysql_error());
$insertGoTo = "administrar.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>