Ver Mensaje Individual
  #3 (permalink)  
Antiguo 29/12/2007, 22:41
inorganico0
 
Fecha de Ingreso: mayo-2006
Ubicación: Ciudad de Buenos Aires
Mensajes: 78
Antigüedad: 18 años
Puntos: 2
Re: resultado vacio con error

Cita:
Iniciado por Seppo Ver Mensaje
Código 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=\"delete2.php?accion=borrar\" method=\"POST\">
<b>Nombre:</b><br>..."
;

Tan simple era... de todas maneras no me sirvió, pero creo q porque no aclaré algo, el final de toda la tabla existe un "elseif" y ahora me tira error ese.
está asi el codigo:

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>";
}
elseif($accion==guardar){
$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";


ahora cual seria la solución?
muchisimas gracias por la pronta respuesta y perdon por no haber indicado todo el problema de antemano!