Foros del Web » Programando para Internet » PHP »

No me reconoce el $id

Estas en el tema de No me reconoce el $id en el foro de PHP en Foros del Web. que tal amigos, consulta, tengo mi sentencia mysql.... que cuando la pongo de esta manera... Código PHP: $rs  =  mysql_query ( "select Nombre, Apellido, Direccion, Telefono from datos where Id = $id" );  me genera ...
  #1 (permalink)  
Antiguo 18/06/2008, 18:07
Avatar de Fogox  
Fecha de Ingreso: abril-2008
Mensajes: 59
Antigüedad: 16 años
Puntos: 0
No me reconoce el $id

que tal amigos, consulta, tengo mi sentencia mysql.... que cuando la pongo de esta manera...
Código PHP:
$rs mysql_query("select Nombre, Apellido, Direccion, Telefono from datos where Id = $id"); 
me genera conflictos y no me reconoce el ID...
cuando lo pongo asi...
Código PHP:
$rs mysql_query("select Nombre, Apellido, Direccion, Telefono from datos where Id = '$id'"); 
pero cuando pongo,
Código PHP:
$rs mysql_query("select Nombre, Apellido, Direccion, Telefono from datos where Id"); 
me levanta los datos pero no los puedo pasar luego

mi idea es que los datos que envio por un formulario los muestre y se puedan modificar...,
tienen idea que puede ser?

este es el formulario que muestra y envia la informacion....
Código PHP:
[HTML] <?php  
include ('conexion.php');

 
$rs mysql_query("select Id, Nombre , Apellido, Direccion, Telefono from datos");  
    
?>  
    <table border="1">  
    <tr>  
    <th>Id</th>  
    <th>Nombre</th>  
    <th>Apellido</th>  
    <th>Direccion</th>  
    <th>Telefono</th>  
    </tr>  
    <?php  

        
while (list($Id$Nombre$Apellido$Direccion$Telefono) = mysql_fetch_row($rs)) {  
    
?>  
    <tr>  
    <td><a href="actualiza_usuario.php?id= <?= $Id ?>"><? echo $Id?></a></td>  
    <td><? echo $Nombre?></td>  
    <td><? echo $Apellido?></td>  
    <td><? echo $Direccion?></td>  
    <td><? echo $Telefono?></td>  
    </tr>  
    <?  
        
}  
    
?>  
    </table> [/HTML]
este es el que lo recibe....

Código PHP:
[HTML]<?php
include ('conexion.php');
echo 
'<p>';
echo 
'actualiza usuario'.'<p>';

    
//    $rs = mysql_query("select Nombre, Apellido, Direccion, Telefono from datos where Id = $id");
    
$rs mysql_query("select Nombre, Apellido, Direccion, Telefono from datos where Id");
    list(
$nombre,$apellido,$direccion,$telefono) = mysql_fetch_row($rs);





?>

<h2>Actualiza Cliente <?= $nombre ?></h2>
<a href="actualizar.php?id=<?= $id ?>">Actualiza</a>

<br>
<br>
<form action="actualizar.php" method="post">
<input type="hidden" name="id" value='<?= $id ?>'>
<table>
<tr>
<td>Id</td>
<td><?= $id ?></td>
</tr>
<tr>
<td>Nombre</td>
<td><input type="text" name="nombre" value='<?= $nombre ?>'></td>
</tr>
<tr>
<td>apellido</td>
<td><input type="text" name="apellido" value='<?= $apellido ?>'></td>
</tr>
<tr>
<td>direccion</td>
<td><input type="text" name="direccion" value='<?= $direccion ?>'></td>
</tr>
<tr>
<td valign="top">telefono</td>
<td>
<input type="text" name="telefono" value='<?= $telefono ?>'>
</td>
</tr>
</table>
<input type="submit" value="Aceptar">
</form>[/HTML]
gracias por tomarce la molestia de ver mi consulta
  #2 (permalink)  
Antiguo 18/06/2008, 18:13
Avatar de terepaima  
Fecha de Ingreso: junio-2008
Mensajes: 82
Antigüedad: 15 años, 10 meses
Puntos: 1
Respuesta: No me reconoce el $id

Hola, solo un recordatorio...

Acuerdate que aqui se diferencian mayusculas de minusculas, chequea tu codigo.
  #3 (permalink)  
Antiguo 18/06/2008, 22:02
Avatar de nuevo  
Fecha de Ingreso: mayo-2003
Ubicación: Spain
Mensajes: 2.009
Antigüedad: 20 años, 11 meses
Puntos: 2
Respuesta: No me reconoce el $id

xddd buen ojo.
__________________
3w.valenciadjs.com
3w.laislatv.com
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 03:36.