Ver Mensaje Individual
  #3 (permalink)  
Antiguo 10/03/2009, 04:55
ositaprh
 
Fecha de Ingreso: marzo-2009
Mensajes: 12
Antigüedad: 15 años, 1 mes
Puntos: 1
Respuesta: Filtrar una consulta con php a traves de un enlace

aun asi cambiandolo ahora no me carga nada.

(la sentencia la escribi mal esta mñn pq ayer la estube poniendo como as dicho pero la acabe borrando)

ahora queda asi:

<html>
<head>
<title>Games Line</title>
<style type="text/css">
<!--
body,td,th {
color: #FF9933;
}
body {
background-color: #000000;
}
.Estilo1 {color: #CC6600}
.Estilo2 {color: #CC9900; }
-->
</style>
<script language="JavaScript">


</script>
</head>
<body>
<form name="frm_joc" action="default.php" method="POST">
<table width="762" height="68%" border="1" align="center" bordercolor="black" bgcolor="#000000" id="tc">
<tr>
<th width="90" rowspan="3">&nbsp;</th>
<th width="668" height="65" colspan="6"><img src="imagenes/cabecera.gif"></th>
<th width="80" rowspan="3">&nbsp;</th>
</tr>

<tr bordercolor="white">
<th height="60"><a href="default.php" class="Estilo1" onClick="frm_joc.submit();"<? $_POST['plataforma']=="PC";?>>PC</a> </th>
<th><a href="default.php" class="Estilo1" onClick="<? $_POST['plataforma']=="DS";?>">Nintendo DS</a> </th>
<th><a href="default.php" class="Estilo1" onClick="frm_joc.submit();"<? $_POST['plataforma']=="WII";?>>Nintendo WII</a> </th>
<th><a href="default.php" class="Estilo1" onClick="frm_joc.submit();"<? $_POST['plataforma']=="PS2";?>>PlayStation 2 </a></th>
<th><a href="default.php" class="Estilo1" onClick="frm_joc.submit();"<? $_POST['plataforma']=="PS3";?>>PlayStation 3 </a> </th>
<th><a href="default.php" class="Estilo1" onClick="frm_joc.submit();"<? $_POST['plataforma']=="360";?>">XBOX 360 </a></th>
</tr>
<tr>
<th height="132" colspan="6">
<?
$connexio = mysql_connect ('localhost','root','');
mysql_select_db ('videojocs',$connexio);


$criterio="";
switch($_POST['plataforma']){
case "PC":
$criterio="'PC'";
break;
case "DS":
$criterio="'DS'";
break;
case "WII":
$criterio="'WII'";
break;
case "PS2":
$criterio="'PS2'";
break;
case "PS3":
$criterio="'PS3'";
break;
case "360":
$criterio="'360'";
break;
}

$resultado = mysql_query ("SELECT id_videojoc, titol, descripcio, imatge, plataforma FROM videojocs WHERE plataforma='$criterio' ORDER BY titol");


$juegos = mysql_fetch_array($resultado);

while ($juegos != FALSE){
$campo=substr($juegos['descripcio'],0,300);
echo '<p>&nbsp;</p>';
echo '<p>&nbsp;</p>';
echo '<table width="600" border="1" cellspacing="3">';
echo '<tr>';
echo '<td width="160"> <img width="158" src="imatges/'.$juegos['imatge'].'"></td>';
echo '<td width="420">'.$campo.'... <a href="detall.php" id="'.$juegos['id_videojoc'].'" class="Estilo1">Leer más.</a></td>';
echo '</tr>';
echo '</table>';
echo '<p>&nbsp;</p>';

$juegos = mysql_fetch_array($resultado);
}

mysql_close ($connexio);

?>
</table>
</form>
</body>
</html>