Ver Mensaje Individual
  #4 (permalink)  
Antiguo 01/03/2011, 15:33
nuevoconphp
 
Fecha de Ingreso: febrero-2011
Mensajes: 64
Antigüedad: 13 años, 2 meses
Puntos: 3
Pregunta Respuesta: hacer consulta con link??

Cita:
Iniciado por jotaincubus Ver Mensaje
Pasas por $_GET la variable que identifica el campo que quieres mostrar en la otra pagina asi:

Código PHP:
<a href="jq/jqp/photogallery/imagenes_upload/borrar1.php?variable="><?php echo $row_Recordset1['albuns']; ?></a>
despues en la otra pagina recoges la variable y haces el select

Código PHP:
consulta "SELECT * FROM tabla WHERE campo = '".$_GET['variable']."'" 

algo estoy haciendo mal porque en la segunda pagina no me muestra nada, aparece vacia: me pudieran decir q hago mal, gracias.

Pag #1:

Código:
mysql_select_db($database);
$query_Recordset1 = "SELECT albuns FROM `albun de fotos`";
$Recordset1 = mysql_query($query_Recordset1, $IBC) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!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>Untitled Document</title>
</head>

<body>
<table>
  <tr>
    <td></td>
  </tr>
  <?php do { ?>
    <tr>
      <td>  <a href="jq/jqp/photogallery/imagenes_upload/borrar1.php?$albun="><?php echo $row_Recordset1['albuns']; ?></a> </td>
    </tr>
    <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
Pag#2

Código:
mysql_select_db($database);
$query_Recordset1 = "SELECT userName FROM `admin` WHERE adminId='".$_GET['$albun']."'";
$Recordset1 = mysql_query($query_Recordset1, $IBC) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!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>Untitled Document</title>
</head>

<body>
<table>
  <tr>
    <td>id_albuns</td>
  </tr>
  <?php do { ?>
    <tr>
      <td><?php echo $row_Recordset1['userName']; ?></td>
    </tr>
    <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>