Ver Mensaje Individual
  #9 (permalink)  
Antiguo 08/01/2005, 14:52
mon
 
Fecha de Ingreso: febrero-2003
Mensajes: 506
Antigüedad: 21 años, 2 meses
Puntos: 0
A ver si me podeis hechar un vistazo a este código.
Cómo decía antes tengo una hoja clientes.php donde tengo un listado de los mismos, si pincho sobre uno de ellos voy a otra hoja tablacliente.php donde muestro todos los datos de ese cliente, una vez en pantalla esos datos los puedo modificar y los envío a recojotablaclientes.php, donde cojo las variables para mandarlas a la tabla, pues bién este es el código que no consigo que funcione, no puede hacer la consulta, me dice
Código PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>:: DATOS ACTUALIZADOS CLIENTE ::</title>
<style type="text/css">
<!--
body,td,th {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #000000;
}
body {
    background-image: url(/Images/fondo2.gif);
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
}
.Estilo1 {font-size: 9px}
-->
</style></head>
<?
      $id
=$HTTP_POST_VARS[id];
       
$fe=$HTTP_POST_VARS[fecha];
      
$ref=$HTTP_POST_VARS[referencia];
      
$n=$HTTP_POST_VARS[nombre];
      
$ap1=$HTTP_POST_VARS[apellido1];
      
$ap2=$HTTP_POST_VARS[apellido2];
      
$di=$HTTP_POST_VARS[direccion];
      
$t=$HTTP_POST_VARS[telefono];
      
$em=$HTTP_POST_VARS[email];
      
$des=$HTTP_POST_VARS[descripcion];
           


    

include(
"conectobd.php");
if (
$iden!=""

    
$sql "SELECT * FROM clientes WHERE ID=$iden" 

else
{
    
$sql "UPDATE clientes SET fecha=$fe, referencia=$ref, nombre=$n, apellido1=$ap1, apellido2=$ap2, telefono=$te, email=$em, direccion=$di WHERE ID=$iden";
}
$consulta mysql_query($sql) or die ("No se pudo ejecutar la consulta"); 
//$registro=mysql_fetch_assoc($consulta); 
//echo "<table width=630 bgcolor=#A6D9FF align=center border=0 id=tabla>";  //TABLA PRINCIPAL DE REF. FECH DESCR. Y FOTOS
        //$fecha=$registro['fecha'];
          // $var = explode('-',$fecha);
        //"".$var[2]."-".$var[1]."-".$var[0]."";
        
?>
                        

<body>
<table width="648" align="center" cellpadding="0" cellspacing="0" bgcolor="#A6D9FF">
  <tr>
    <td><table align="center" cellpadding="0"  cellspacing="0">
      <tr>
        <td><img src="../Images/logotipo2/logotipo_01.gif" width="297" height="45"></td>
        <td><img src="../Images/logotipo2/logotipo_02.gif" width="333" height="45"></td>
      </tr>
      <tr>
        <td><img src="../Images/logotipo2/logotipo_03.gif" width="297" height="52"></td>
        <td><img src="../Images/logotipo2/logotipo_04.gif" width="333" height="52"></td>
      </tr>
    </table></td>
  </tr>
</table>
<table width="648" align="center" cellpadding="0" cellspacing="0" bgcolor="#A6D9FF">
  <tr>
    <td><form name="form1" method="post" action="">
      <table width="648" cellspacing="0" cellpadding="0">
        <tr>
          <td><table width="100%" align="center" cellpadding="0"  cellspacing="0">
            <tr>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td width="16%">C&oacute;digo cliente </td>
              <td width="6%"><input name="codigo_cliente" type="text" id="codigo_cliente" size="3" maxlength="5" value="<? echo $id ;?> "></td>
              <td width="17%"><div align="right">Nombre </div></td>
              <td width="24%"><div align="right">
                  <input name="nombre" type="text" id="nombre" value="<? echo $n ?> ">
              </div></td>
              <td width="11%">&nbsp;</td>
              <td width="7%">Fecha</td>
              <td width="19%"><input name="fecha" type="text" id="fecha" size="10" maxlength="10" value="<? echo $fe;?>"></td>
            </tr>
          </table>
            <br>
            <table width="100%"  cellspacing="0" cellpadding="0">
              <tr>
                <td width="17%">Ref. Inmueble </td>
                <td width="9%"><input name="referencia" type="text" id="referencia" value="<? echo $ref?> " size="8" maxlength="10"></td>
                <td width="1%">&nbsp;</td>
                <td width="13%"><div align="right">Apellidos</div></td>
                <td width="25%"><input name="apellido1" type="text" id="apellido1" value="<? echo $ap1?> "></td>
                <td width="35%"><input name="apellido2" type="text" id="apellido2" value="<? echo $ap2?> "></td>
              </tr>
          </table></td></tr>
        <tr>
          <td><table width="100%"  cellspacing="0" cellpadding="0">
            <tr>
              <td width="34%"><div align="right">Tel&eacute;fono</div></td>
              <td width="33%"><input name="telefono" type="text" id="telefono" size="10" maxlength="12" value="<? echo $t?> "></td>
              <td width="33%"><div align="right">Direcci&oacute;n</div></td>
              <td width="66%"><input name="direccion" type="text" id="direccion" size="40" value="<? echo $di?> "></td>
            </tr>
          </table></td>
        </tr>
        <tr>
          <td><table width="100%"  cellspacing="0" cellpadding="0">
            <tr>
              <td width="17%">Datos Inmueble</td>
              <td width="7%">&nbsp;</td>
              <td width="28%"><div align="right">E-mail </div></td>
              <td width="24%"><div align="center">
                  <input name="email" type="text" id="email" value="<? echo $em?> ">
              </div></td>
              <td width="8%"><input name="Email" type="submit" id="Email" value="Email" action="mailto:[email protected]" >
              </td>
              <td width="16%"><div align="center"><span class="Estilo1">(enviar email)</span></div></td>
            </tr>
          </table></td>
        </tr>
        <tr>
          <td><table width="100%"  cellspacing="0" cellpadding="0">
            <tr>
              <td><div align="center">
                  <textarea name="descripcion" cols="75" rows="15" id="descripcion" ><? echo $des;?></textarea>
              </div></td>
            </tr>
          </table></td>
        </tr>
        <tr>
          <td><input name=idclose type=button value="Cerrar" onclick="window.close()" style="border: 1px solid #000080">
            <input type="submit" name="Submit" value="BORRAR">
            DATOS ACTUALIZADOS </td>
        </tr>
      </table>
    </form></td>
  </tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>
Puede tener algo que ver que los datos esten todos relacionados con un identificador?, si veis algo raro en el código me lo decís, por favor, es que no va, decir también que las variables haciendo un echo de las mismas llegan bien, el caso es que no puedo hacer la consulta, venga gracias