Ver Mensaje Individual
  #4 (permalink)  
Antiguo 29/01/2012, 11:24
juankardj
 
Fecha de Ingreso: enero-2012
Mensajes: 10
Antigüedad: 12 años, 3 meses
Puntos: 0
Respuesta: Warning: mysql_fetch_assoc():

Cita:
Iniciado por pateketrueke Ver Mensaje
Es normal, inicialmente estás usando $queEmp y después usas $quEmp

¿No notas nada extraño?

gracias, pues si era eso, pero es que soy muy torpe, y ahora tengo otro error en otro archivo:

<?php
require("conexion.php");
require("funciones.php");

$idempresa = getParam($_GET["id"], "-1");
$action = getParam($_GET["action"], "");

if ($action == "edit") {
$idempresa = getParam($_POST["id"], "-1");
$nombre = sqlValue($_POST["nombre"], "text");
$direccion = sqlValue($_POST["direccion"], "text");
$telefono = sqlValue($_POST["telefono"], "int");

$sql = "UPDATE empresa SET ";
$sql.= "nombre=".$nombre.", direccion=".$direccion.", telefono=".$telefono." ";
$sql.= "WHERE id=".$idempresa;
mysql_query($sql, $conexion);
header("location: listado.php");
}

$sql = "SELECT * FROM empresa WHERE id = ".sqlValue($idempresa, "int");
$queEmp = mysql_query($sql, $conexion);
$rsEmp = mysql_fetch_assoc($queEmp);
$total = mysql_num_rows($queEmp);
if ($total == 0) {
header("location: listado.php");
exit;
}
?>
<!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=UTF-8" />
<title>PHP con MySQL: Editar datos en MySQL</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h3>Editar Empresa</h3>
<?php if ($status == "ok") { ?>
<p class="confirm">Registro guardado correctamente</p>
<?php } ?>
<form method="post" id="frEmpresa" action="editar.php?action=edit">
<label for="nombre">Nombre</label>
<input type="text" id="nombre" name="nombre" value="<?php echo $rsEmp["nombre"]; ?>" />
<br />
<label for="direccion">Direcci&oacute;n</label>
<input type="text" id="direccion" name="direccion" value="<?php echo $rsEmp["direccion"]; ?>" />
<br />
<label for="telefono">Telefono</label>
<input type="text" id="telefono" name="telefono" value="<?php echo $rsEmp["telefono"]; ?>" />
<br />
<label for="bts">&nbsp;</label>
<button type="submit">Guardar</button>
<button type="reset">Limpiar</button>
<input type="hidden" id="id" name="id" value="<?php echo $rsEmp["id"]; ?>" />
</form>
</body>
</html>



el error es:

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/juankar/public_html/bases/eliminar/editar.php on line 23

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/juankar/public_html/bases/eliminar/editar.php on line 24

Warning: Cannot modify header information - headers already sent by (output started at /home/juankar/public_html/bases/eliminar/editar.php:23) in /home/juankar/public_html/bases/eliminar/editar.php on line 26



perdona por mi ignorancia en el asunto