Warning: sprintf() [function.sprintf]: Too few arguments in C:\wamp\www\multisillas\site\admin\ing_prod.php on line 48
Query was empty
y este es mi codigo
Código PHP:
<?php require_once('../Connections/multisillas.php'); ?>
<?php
include_once("fckeditor/fckeditor.php") ;
?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "''";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "''";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "''";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "''";
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")) {
$ediciondir= '../imgprod/';
$uploaddir=$ediciondir;
if (!is_dir($ediciondir)) { mkdir($uploaddir, 0777); }
move_uploaded_file($_FILES['imagen']['tmp_name'], $uploaddir . $_FILES['imagen']['name']);
$filename = $_FILES['imagen']['name'];
$insertSQL = sprintf("INSERT INTO productos (id, id_cat, nombre, codigo, descripcion, imagen) VALUES (%s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['id_cat'], "int"),
GetSQLValueString($_POST['nombre'], "text"),
GetSQLValueString($_POST['codigo'], "text"),
GetSQLValueString($_POST['descripcion'], "text"),
GetSQLValueString($filename, "text"));
mysql_select_db($database_multisillas, $multisillas);
$Result1 = mysql_query($insertSQL, $multisillas) or die(mysql_error());
$insertGoTo = "listado_prod.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_multisillas, $multisillas);
$query_Recordset1 = "SELECT * FROM categoria";
$Recordset1 = mysql_query($query_Recordset1, $multisillas) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>