Gracias!!!!
Unknow columm 'codigo' in 'field' list
Codigo
Código PHP:
<?php require_once('../../Connections/listproduc.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")) {
$ediciondir= '../../images2/';
$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 producto (PKIDCAT, nombre, codigo, descripcion, imagen) VALUES (%s, %s, %s, %s, %s)",
GetSQLValueString($_POST['PKIDCAT'], "int"),
GetSQLValueString($_POST['nombre'], "text"),
GetSQLValueString($_POST['codigo'], "text"),
GetSQLValueString($_POST['descripcion'], "text"),
GetSQLValueString($filename, "text"));
mysql_select_db($database_listproduc, $listproduc);
$Result1 = mysql_query($insertSQL, $listproduc) or die(mysql_error());
$insertGoTo = "listproducto.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_listproduc, $listproduc);
$query_Recordset1 = "SELECT * FROM categoria";
$Recordset1 = mysql_query($query_Recordset1, $listproduc) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>