Soy nueva en el foro y os mando un saludo jeje.
Vereis, tengo un problema como el de muchos que han tenido pero que no he llegado a solucionar.
Al utilizar sesiones con while siempre me da el valor del ultimo registro de mysql, y no se como hacer que tenga el valor de todos los datos.
Este es mi codigo
index.php
Código PHP:
Ver original
<?php ?> <html> <head> <link rel="stylesheet" href="styles.css" type="text/css"> </head> <body> <?php $ord="select * from subirhyip"; while($row) { $_SESSION['id']=$row['id']; $_SESSION['site']=$row['site']; $_SESSION['url']=$row['url']; $_SESSION['inter']=$row['inter']; $_SESSION['min']=$row['min']; $_SESSION['max']=$row['mac']; $_SESSION['ref']=$row['ref']; $_SESSION['wit']=$row['wit']; $id=$_SESSION['id']; $site=$_SESSION['site']; $url=$_SESSION['url']; $inter=$_SESSION['inter']; $min=$_SESSION['min']; $max=$_SESSION['max']; $ref=$_SESSION['ref']; $wit=$_SESSION['id']; echo '<table class="todu" width="600" cellspacing="0"> <tr> <td width="200" align="left" class="upaying"> <a href="http://'.$url.'"> <font size="4">'.$site.'</font></a> </td> <td align="center" width="200" class="upaying" > <img src="paying.png" height="100%"> </td> <td align="right" width="200" class="upaying"> <a href="datos.php?id='.$site.'">View votes</a> | <a href="">Report Scam</a> </td> </tr> <tr> <td valign="top" width="200" bgcolor="98FB98"> Min: <b>'.$min.'</b><br> Max: <b>'.$max.'</b><br> </td> <td valign="top" colspan="2" width="400" bgcolor="98FB98"> Referral: <b>'.$ref.'</b><br> Whitdraw:<b>'.$wit.'</b><br> Added: <b>'.$adde.'</b> </td> </tr> <tr> <td align="left" bgcolor="98FB98" class="plans" colspan="3"> '.$inter.' </td> </tr> </table>'; } ?> </body> </html>
Hasta aqui todo bien, o eso parece. pero en la segunda pagina,
hyip.php?id="variable" me muestra correctamente la id en la url, pero no el resto de los datos personales de la empresa escogida.
Esta es la segunda pagina
hyip.php
Código PHP:
Ver original
<?php ?> <html> <head> </head> <body> <?php $ord="select * from subirhyip where id='$id'"; echo '<table width="70%" align="center"><tr><td valign="top">'; echo "Sitio:".$row['site']."<br>"; echo "<a href='".$row['url']."'>Ir a la web</a>"; ?> </body> </html>
No entiendo porque me salen en todos los casos los mismos datos.
Entonces como e de hacerlo?
Tengo que hacer algo asi como $_SESSION['$variable'], osea meter una variable de $row entre los corchetes?
Tengo que poner las sesiones antes del while, despues, dentro o como lo hago?
Agradezco mucho vuestra ayuda.
Saludos