Ver Mensaje Individual
  #5 (permalink)  
Antiguo 03/02/2011, 13:17
danielcampostorres
 
Fecha de Ingreso: febrero-2011
Mensajes: 5
Antigüedad: 13 años, 3 meses
Puntos: 0
Respuesta: tabla dinamica despues del combobox

mmm te comento no me funko,
me aparecen estos errores:
Seleccione RUT NOMBRES TRIBUNAL

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\dinamica.php on line 50

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\dinamica.php on line 58


de hechos son dos tablas hice esto pero aun no me funka:
<html>

<script type="text/javascript">
function datosTrab(tribunal){
document.location.href='http://127.0.0.1/dinamica.php?valor='+tribunal;
}
</script>

<body>
<?php
require_once ('Connections/zonalsantiago.php');
mysql_select_db($database_zonalsantiago, $zonalsantiago);
$result = mysql_query("SELECT * FROM tribunal");
?>

<select name="select" onChange="datosTrab(this.value);">
<option value="0">Seleccione</option>

<?php
$tribunal=$_GET["valor"];
$seleccionado="";
while($row = mysql_fetch_array($result))
{
if ($row['id_tribunal']==$tribunal)
{
$seleccionado="selected";
}
else
{
$seleccionado="";
}

echo "<option value=".$row['id_tribunal']." ".$seleccionado.">".$row['nom_tribunal']."</option>\n";
}
?>
</select>

<?php
$resTrab = mysql_query("select t.`rut`,concat(t.`nombres`,' ',t.`apellido_pat`) as nomTrab, tr.`tribunal` from `trabajadores` t
inner join `tribunal` tr on tr.`id_tribunal`=t.`id_tribunal`
where t.`id_tribunal`=$tribunal");
?>
<table border="1" align="center" BORDERCOLOR="#000000">
<tr>
<td width="128"><strong>RUT</strong></td>
<td width="395"><strong>NOMBRES</strong></td>
<td width="209"><strong>TRIBUNAL</strong></td>
</tr>
<?php
while($row2 = mysql_fetch_array($resTrab))
{
echo "<tr>";
echo "<td>".$row2['rut']."</td>";
echo "<td>".$row2['nomTrab']."</td>";
echo "<td>".$row2['nombre_tribunal']."</td>";
echo "</tr>\n";
}
mysql_free_result($resTrab);
?>
</table>
</body>
</html>

de hecho creo que el error podria estar en los campos de las tablas en el join.