Foros del Web » Programando para Internet » PHP »

Problemas con Mysql_query or die (tal vez el update?)

Estas en el tema de Problemas con Mysql_query or die (tal vez el update?) en el foro de PHP en Foros del Web. Hola buenas tardes a todos, gracias por leer mi nota, tengo un problemilla en la actualizacion de una tabla, pues siempre me envia error que ...
  #1 (permalink)  
Antiguo 27/12/2008, 14:14
 
Fecha de Ingreso: diciembre-2008
Ubicación: http://www.solucionesrios.tk/
Mensajes: 413
Antigüedad: 15 años, 4 meses
Puntos: 19
Busqueda Problemas con Mysql_query or die (tal vez el update?)

Hola buenas tardes a todos, gracias por leer mi nota, tengo un problemilla en la actualizacion de una tabla, pues siempre me envia error que no se pudo conectar porque el valor ya existe (no creo que sea problemas con el mysql, o no estoy seguro)

aca les dejo el codigo php a ver si ven el error, que yo no lo veo.

Código PHP:
<?PHP 

include("conectarse.php");

    
$id $_POST["id"]; 
    
$serialemp=$_POST["serial1"];
    
$serial=$_POST["serial2"];
    
$descripcion=$_POST["descripcion"];
    
$proveedor=$_POST["proveedor"];
    
$ubicacion=$_POST["ubicacion"];
    
$ubicacion2=$_POST["ubicacion2"];
    
$factura=$_POST["factura"];
    
$cantidad=$_POST["cantidad"];
    
$precio=$_POST["precio"];
    
$adq_dia=$_POST["adq_dia"];
    
$adq_mes=$_POST["adq_mes"];
    
$adq_ano=$_POST["adq_ano"];
    
$gar_dia=$_POST["gar_dia"];
    
$gar_mes=$_POST["gar_mes"];
    
$gar_ano=$_POST["gar_ano"];
    
$estado=$_POST["estado"];
    
$ci_responsable=$_POST["ci_responsable"];
    
$nombre_responsable=$_POST["nombre_responsable"];
    
$ci_usuario=$_POST["ci_usuario"];
    
$nombre_usuario=$_POST["nombre_usuario"];
    
$comentario=$_POST["comentario"];
    if (
$adq_mes == "Ene")
        
$Mes "01";
    else if (
$adq_mes == "Feb")
        
$Mes "02";
    else if (
$adq_mes == "Mar")
        
$Mes "03";
    else if (
$adq_mes == "Abr")
        
$Mes "04";
    else if (
$adq_mes == "May")
        
$Mes "05";
    else if (
$adq_mes == "Jun")
        
$Mes "06";
    else if (
$adq_mes == "Jul")
        
$Mes "07";
    else if (
$adq_mes == "Ago")
        
$Mes "08";
    else if (
$adq_mes == "Sep")
        
$Mes "09";
    else if (
$adq_mes == "Oct")
        
$Mes "10";
    else if (
$adq_mes == "Nov")
        
$Mes "11";
    else if (
$adq_mes == "Dic")
        
$Mes "12";
    
$Fecha_adq $adq_ano"/" .$Mes"/" .$adq_dia;
    if (
$gar_mes == "Ene")
        
$Mesg "01";
    else if (
$gar_mes == "Feb")
        
$Mesg "02";
    else if (
$gar_mes == "Mar")
        
$Mesg "03";
    else if (
$gar_mes == "Abr")
        
$Mesg "04";
    else if (
$gar_mes == "May")
        
$Mesg "05";
    else if (
$gar_mes == "Jun")
        
$Mesg "06";
    else if (
$gar_mes == "Jul")
        
$Mesg "07";
    else if (
$gar_mes == "Ago")
        
$Mesg "08";
    else if (
$gar_mes == "Sep")
        
$Mesg "09";
    else if (
$gar_mes == "Oct")
        
$Mesg "10";
    else if (
$gar_mes == "Nov")
        
$Mesg "11";
    else if (
$gar_mes == "Dic")
        
$Mesg "12";
    
$Fecha_gar $gar_ano"/" .$Mesg"/" .$gar_dia;

$sql "UPDATE 
`activos`.`activo` 
SET 
`serialemp` = '$serialemp',
`serial` = '$serial',
`descripcion` = '$descripcion',
`proveedor` = '$proveedor',
`ubicacion` = '$ubicacion',
`ubicacion2` = '$ubicacion2',
`factura` = '$factura',
`cantidad` = '$cantidad',
`precio` = '$precio',
`estado` = '$estado',
`ci_responsable` = '$ci_responsable',
`nombre_responsable` = '$nombre_responsable',
`ci_usuario` = '$ci_usuario',
`nombre_usuario` = '$nombre_usuario',
`comentario` = '$comentario',
`fecha_gar` = '$Fecha_gar'
`fecha_adq` = '$Fecha_adq',
  WHERE
`activo`.`serialemp` = '$id' LIMIT 1 ;"
;

    
mysql_query($sql) or die ("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' />
<title>Sistema de Inventario</title>
<style type='text/css'>
<!--
body,td,th {
    color: #FFFFFF;
}
body {
    background-color: #339900;
    background-image: url(Fondo.jpg);
    background-repeat: repeat-x;
}
-->
</style></head>

<body>
<p><strong>SERIAL EMPRESARIAL  DEL ACTIVO FIJO YA EXISTE EN LA BASE DE DATOS</strong></p>
<p><strong>POR FAVOR INGRESE UNO NUEVO</strong>.</p>
<p><a href='Nuevo_Personal.html'></a>
  <object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' width='50' height='37' title='Regresar'>
    <param name='BGCOLOR' value='#006600' />
    <param name='movie' value='button16.swf' />
    <param name='quality' value='high' />
    <embed src='button16.swf' width='50' height='37' quality='high' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' bgcolor='#006600' ></embed>
  </object>
</p>
<p>Haga clic en el bot&oacute;n de arriba para regresar al Mantenimiento de Proveedores. </p>
</body>
</html>"
);


    
mysql_free_result($sql);
    
header("Location: mantenimiento_activo.php");
    include(
"desconectarse.php"); 
    
?>
  #2 (permalink)  
Antiguo 27/12/2008, 14:14
 
Fecha de Ingreso: diciembre-2008
Ubicación: http://www.solucionesrios.tk/
Mensajes: 413
Antigüedad: 15 años, 4 meses
Puntos: 19
Respuesta: Problemas con Mysql_query or die (tal vez el update?)

Y aqui el codigo de las tablas MySQL

Código:
-- phpMyAdmin SQL Dump
-- version 3.0.1.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Dec 27, 2008 at 08:13 PM
-- Server version: 5.1.30
-- PHP Version: 5.2.7

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

--
-- Database: `activos`
--

-- --------------------------------------------------------

--
-- Table structure for table `activo`
--

CREATE TABLE `activo` (
  `serialemp` varchar(50) NOT NULL,
  `serial` varchar(50) NOT NULL,
  `descripcion` varchar(50) NOT NULL,
  `proveedor` varchar(50) NOT NULL,
  `ubicacion` varchar(30) NOT NULL,
  `ubicacion2` varchar(30) DEFAULT NULL,
  `factura` varchar(15) NOT NULL,
  `cantidad` int(30) NOT NULL,
  `precio` varchar(200) NOT NULL,
  `estado` varchar(32) NOT NULL,
  `ci_responsable` varchar(40) NOT NULL,
  `nombre_responsable` varchar(30) NOT NULL,
  `ci_usuario` varchar(40) NOT NULL,
  `nombre_usuario` varchar(30) NOT NULL,
  `comentario` varchar(200) DEFAULT NULL,
  `fecha_gar` date NOT NULL,
  `fecha_adq` date NOT NULL,
  PRIMARY KEY (`serialemp`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `activo`
--

INSERT INTO `activo` (`serialemp`, `serial`, `descripcion`, `proveedor`, `ubicacion`, `ubicacion2`, `factura`, `cantidad`, `precio`, `estado`, `ci_responsable`, `nombre_responsable`, `ci_usuario`, `nombre_usuario`, `comentario`, `fecha_gar`, `fecha_adq`) VALUES
('1', '1', 'PRUEBA 1', 'ABC', 'Caracas', 'PRUEBA 1', 'PRUEBA1', 5, '500', 'Fuera de servicio / No Activo', '15727241', 'R?os Romero, Ricardo Jos', '15727241', 'R?os Romero, Ricardo Jos', 'PRUEBA 1PRUEBA 1PRUEBA 1PRUEBA 1PRUEBA 1PRUEBA 1', '2056-12-31', '2009-01-01'),
('4', 'N/A', '1', 'PRUEBA ESPACIO', 'Caracas', 'uni space', '1', 1, '500', 'En Stock / por Activar', '3297776', 'A?ez, Edwin', '13000770', 'Vilchez Molaya, Marco Antonio', 'aaaaaaaaaaaa aaaaaaaaaaaaaa aaaaaaaaaaaaa aaaaaaaaaaaa', '2027-07-17', '2009-01-19');

-- --------------------------------------------------------

--
-- Table structure for table `proveedores`
--

CREATE TABLE `proveedores` (
  `nombre` varchar(30) NOT NULL,
  `rif` varchar(15) NOT NULL,
  `tipo` varchar(50) NOT NULL,
  `direccion` varchar(50) NOT NULL,
  `telefono` varchar(15) NOT NULL,
  `fax` varchar(50) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
  `celular` varchar(15) NOT NULL,
  `correo` varchar(30) NOT NULL,
  PRIMARY KEY (`rif`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `proveedores`
--

INSERT INTO `proveedores` (`nombre`, `rif`, `tipo`, `direccion`, `telefono`, `fax`, `celular`, `correo`) VALUES
('ABC', 'J-12345678-1', 'Abarrotes en General', 'PRUEBA1', '02617515134', '02615555555', '02617515134', '[email protected]'),
('ABC2', 'J-12345678-2', 'Agencias de Viajes', 'PRUEBA2', '02617524030', '02615555555', '02617524030', '[email protected]'),
('4156541', 'J-12345678-3', 'Abarrotes en General', 'PRUEBA3', '04246505961', '02615555555', '02617515134', '[email protected]'),
('ABC', 'J-12345678-4', 'Abarrotes en General', 'PRUEBA4', '04246505961', '04246505961', '12345678901', '[email protected]'),
('PRUEBA ESPACIO', 'V-12345678-1', 'Abarrotes en General', 'PRUEBA ESPACIO', '12345678901', '12345678901', '12345678901', '[email protected]');

-- --------------------------------------------------------

--
-- Table structure for table `responsable`
--

CREATE TABLE `responsable` (
  `cedula` int(10) NOT NULL,
  `nombre` varchar(50) NOT NULL,
  `cargo` varchar(30) NOT NULL,
  PRIMARY KEY (`cedula`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `responsable`
--

INSERT INTO `responsable` (`cedula`, `nombre`, `cargo`) VALUES
(2620563, 'Nu?ez Rosales, Jesus Antonio', 'Gerente de Administraci?n'),
(3297776, 'A?ez, Edwin', 'L?der de Disciplina Civil'),
(3649387, 'Arrieta Barrios, Rodolfo Emiro', 'Gerente Regional'),
(3929449, 'Urdaneta Villalobos, Rixio Vicente', 'Ingeniero Planificaci?n y Cont'),
(4533192, 'Rivera Portillo, Porfirio', 'Lider Disciplina'),
(4848839, 'Rodriguez, Enrique Jose', 'Proyectista'),
(7821406, 'Ortega Fuenmayor, Denys Giovanny', 'Proyectista'),
(7974729, 'Duno Bracho, Nancy Thais', 'Administrador de Contrato'),
(8501926, 'Carrasquilla Zu?iga, Juan Carlos', 'Proyectista'),
(9113376, 'Galue, Gustavo', 'Proyectista'),
(9701755, 'Villasmil Garcia, Jaila del Carmen', 'Administrador de Contrato'),
(9739173, 'Pati?o Obrador, B?rbara Elena', 'Coordinador Contabilidad'),
(9786552, 'Dominguez Villalobos, Daniel Dario', 'Ingeniero de Proyectos'),
(11884995, 'Urribarri Ferrer, Pedro Antonio', 'Tecnico Proyectista'),
(12099574, 'P?rez Nava, Jhonny Jes?s', 'Proyectista'),
(12379128, 'Quintero Pacheco, Robert Ernesto', 'Dibujante CAD'),
(12871062, 'Molero Diaz, Maria Eugenia', 'Especialista SHA'),
(13000770, 'Vilchez Molaya, Marco Antonio', 'Ingeniero en Compras'),
(13010339, 'Urdaneta Atencio, Edixio Alberto', 'Ingeniero de Proyectos'),
(13301280, 'Rangel Mezzoni, Leonardo Andres', 'Analista Servicios Generales'),
(13301334, 'Zarraga Dominguez, Claudio Alejandro', 'Ingeniero de Proyectos'),
(13363479, 'P?rez Rosales, Yaneth del Carmen', 'Ingeniero de Proyectos'),
(13529381, 'Hernandez Barazarte, Alejandra Virginia', 'Corrdinador RRHH'),
(13529906, 'A?ez Morillo, Maria Eugenia', 'Recepcionista'),
(14511995, 'Cova Parra, Lisethe Coromoto', 'Ingeniero de Proyectos'),
(14556171, 'Cabello Cestari, Maria Eugenia', 'Analista Contable'),
(14896767, 'Hernandez Urdaneta, Eduardo Jose', 'Chofer'),
(15437629, 'S?nchez Olivares, Nestor Luis', 'Ingeniero de Proyectos'),
(15530392, 'Paz Vergara, Yonelsy Carolina', 'Analista Control de Documento'),
(15531212, 'Mary Carmen Marquina', 'Analista Planificaci?n y Contr'),
(15561794, 'Galaviz Jerez, Karolain Coromoto', 'Ingeniero de Proyectos'),
(15562483, 'Vincero Marin, Osmer Alfredo', 'Ingeniero de Proyectos'),
(15726939, 'Rosas Pocaterra, Cesar David', 'Ingeniero de Proyectos'),
(15727241, 'R?os Romero, Ricardo Jos', 'Analista Soporte Usuario'),
(15841456, 'Franco Borjas, Miguel Angel', 'Ingeniero de Proyectos'),
(16119578, 'Arape, Rosmery', 'Analista de Gesti?n Humana'),
(17413687, 'Fernandez Marulanda, Jose Luis', 'Proyectista'),
(17835116, 'Arroyo Alvarez, Diana Carolina', 'Asistente Administrativo'),
(18312688, 'Cuellar Oquendo, Daniel Enrique', 'Asistente de Reproducci?n'),
(18741068, 'Colmenares Urribarri, Paola Carolina', 'Aprendiz INCE'),
(22062270, 'Diaz, Jos? Daniel', 'Mantenimiento'),
(22449659, 'Bol?var Rosario, Isabel Cristina', 'Mantenimiento');

-- --------------------------------------------------------

--
-- Table structure for table `usuarios`
--

CREATE TABLE `usuarios` (
  `usuario` char(10) NOT NULL COMMENT 'Nombre de usuario',
  `clave` char(10) NOT NULL COMMENT 'Clave de Usuario',
  `nivel` int(1) NOT NULL DEFAULT '1',
  PRIMARY KEY (`usuario`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `usuarios`
--

INSERT INTO `usuarios` (`usuario`, `clave`, `nivel`) VALUES
('leonardo', 'leoran', 2),
('marco', 'marvil', 2),
('ricardo', 'vladssj4', 3);
  #3 (permalink)  
Antiguo 27/12/2008, 14:20
Avatar de hgp147  
Fecha de Ingreso: diciembre-2006
Ubicación: Buenos Aires, Argentina
Mensajes: 980
Antigüedad: 17 años, 3 meses
Puntos: 36
Respuesta: Problemas con Mysql_query or die (tal vez el update?)

Cita:
`comentario` = '$comentario',
`fecha_gar` = '$Fecha_gar'
`fecha_adq` = '$Fecha_adq',
Después de '$Fecha_gar' te falta una coma (,) y después de '$Fecha_adq' no va coma (,)
__________________
Spread Firefox | Download Day 2008
¡Únete en nuestra misión para alcanzar el Record Guinness al software más descargado en 24 horas! http://www.spreadfirefox.com/es-ES/worldrecord/
  #4 (permalink)  
Antiguo 27/12/2008, 20:43
 
Fecha de Ingreso: diciembre-2008
Ubicación: http://www.solucionesrios.tk/
Mensajes: 413
Antigüedad: 15 años, 4 meses
Puntos: 19
Respuesta: Problemas con Mysql_query or die (tal vez el update?)

Gracias amigo me ha servido un monton su ayuda, hay que ver que uno no se da cuenta de esos tontos detalles, pueden dar este tema como resuelto
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:21.