Ver Mensaje Individual
  #6 (permalink)  
Antiguo 30/12/2007, 06:25
Avatar de Seppo
Seppo
 
Fecha de Ingreso: marzo-2005
Ubicación: Buenos Aires, Argentina
Mensajes: 1.284
Antigüedad: 19 años, 2 meses
Puntos: 17
Re: resultado vacio con error

Código PHP:
<?php
include "conexion.php";
if (!isset(
$accion)){
    
$result=mysql_query("SELECT * FROM clientes WHERE id=$id",$conexion);
    if (
mysql_num_rows($result) == 0) {
        echo 
"ID inexistente";
    } else {
        
$row=mysql_fetch_row($result);
        echo
"
        <table width=100>
        <tr>
        <form action=\"update.php?accion=guardar\" method=\"POST\">
        <b>Nombre:</b><br>
        <input type=text value=\"$row[1]\" name=\"nombre\" size=50><br><br>
        <b>Dirección:</b><br>
        <input type=\"text\" value=\"$row[2]\" name=\"direccion\" size=50><br><br>
        <b>Telefono:</b><br>
        <input type=\"text\" value=\"$row[3]\" name=\"telefono\" size=15><br><br>
        <b>Movil:</b><br>
        <input type=\"text\" value=\"$row[4]\" name=\"movil\" size=15><br><br>
        <b>Otro:</b><br>
        <input type=\"text\" value=\"$row[5]\" name=\"otro\" size=15><br><br>
        <b>email:</b><br>
        <input type=\"text\" value=\"$row[6]\" name=\"email\" size=30><br><br>
        <b>Tipo:</b><br>
        <input type=\"text\" value=\"$row[7]\" name=\"estado\" size=20><br><br>
        <b>Operación:</b><br>
        <input type=\"text\" value=\"$row[8]\" name=\"operacion\" size=50><br><br>
        <b>Monto:</b><br>
        <input type=\"text\" value=\"$row[9]\" name=\"monto\" size=30><br><br>
        <b>Fecha:</b><br>
        <input type=\"text\" value=\"$row[10]\" name=\"fecha\"><br><br>
        <b>Compartida:</b><br>
        <input type=\"text\" value=\"$row[11]\" name=\"compartida\" size=50><br><br>
        <b>Observaciones:</b><br>
        <input type=\"text\" value=\"$row[12]\" name=\"observaciones\" size=100><br><br><br>
        <input type=\"hidden\" name=\"id\" value=\"$row[0]\">
        <input type=\"submit\" value=\"Guardar\">
        </form>
        </tr>
        </table>
        </body>
        </html>"
;
    }
} else {
    
$sql "UPDATE clientes SET nombre='$nombre', direccion='$direccion', telefono='$telefono', movil='$movil', otro='$otro', email='$email', estado='$estado', operacion='$operacion', monto='$monto', fecha='$fecha', compartida='$compartida', observaciones='$observaciones' WHERE id = $id";
    
$result mysql_query($sql);
    echo
"
    <html>
    <body>
    <b>Los datos han sido actualizados</b>
    </body>
    </html>"
;
}
include 
"cerrar_conexion.php";
?>