Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/03/2011, 14:03
Avatar de vhan99
vhan99
 
Fecha de Ingreso: febrero-2010
Mensajes: 105
Antigüedad: 14 años, 3 meses
Puntos: 1
error en la tabla al filtrar

hola tengo un error en mi codigo php donde mi intencion es primeramente mostrar la tabla con la informacion de la base de datos pero al mandarle la prmiera bsuqueda me salen los siguientes errores:


Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 6 in C:\wamp\www\satelital\tabla5.php on line 99

asta

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 6 in C:\wamp\www\satelital\tabla5.php on line 102

igualmente para row 1,2,3,4,5,6 asta la 7

mi codigo es :

Código PHP:
<html>
<HEAD><TITLE></TITLE></HEAD>
<?php
var_dump
($_REQUEST);
include 
"dbconect.php";
$id=$_REQUEST['id'];
$nombre=$_REQUEST['nombre'];
$estado=$_REQUEST['estado'];
$mail=$_REQUEST['mail'];
$filtro=$_REQUEST['filtro'];
$condicion=$_REQUEST['condicion'];
//$sql= "SELECT * FROM lav $filtro $where $condicion ";
$sql="SELECT * FROM lav";
$result=mysql_query($sql,$db_link)or die (mysql_error());
$num=mysql_numrows($result);
//mysql_close();este es de el segundo o el orijinal segundo lol
if($id!='*'){$filtro="WHERE id = '$id'";}?>
<?php
if ((!$id)){$id="*";}
if (
$id!= '*'){ $filtro "WHERE $id = 'id'";
            if ((
$nombre)&&($estado)&&($mail))$where "AND";
            if ((
$nombre=='*')&&($estado=='*')&&($mail=='*'))$where " ";
}               
else         {
             if ((
$nombre=='*')&&($estado=='*')&&($mail=='*')){$where " ";}
             else
             if ((
$nombre)&&($estado)&&($mail)){$where "where";}}
if ((
$nombre&&$nombre!='*')&&($estado)&&($mail)) $condicion "nombre ='$nombre'";
if ((
$nombre)&&($estado&&$estado!='*')&&($mail)) $condicion "estado ='$estado'";
if ((
$nombre)&&($estado)&&($mail&&$mail!='*')) $condicion "mail ='$mail'";
if ((
$nombre&&$nombre!='*')&&($estado&&$estado!='*')&&($mail)) $condicion "nombre = '$nombre' AND estado='$estado'";
if ((
$nombre&&$nombre!='*')&&($estado)&&($mail&&$mail!='*')) $condicion "nombre = '$nombre' AND mail= '$mail'";
if ((
$nombre)&&($estado&&$estado!='*')&&($mail&&$mail!='*')) $condicion "estado= '$estado' AND mail= '$mail'";
if ((
$nombre&&$nombre!='*')&&($estado&&$estado!='*')&&($mail&&$mail!='*')) $condicion "nombre = '$nombre' AND estado= '$estado' AND mail = '$mail'";
$sql"SELECT * FROM lav $filtro $where $condicion ";
$result  mysql_query($sql,$db_link) or die (mysql_error());?>

    <form action='tabla5.php' method='post'>
    <select name='nombre' onchange='submit();'>  

    <OPTION VALUE="*" selected>--nombre--</OPTION>
    <OPTION VALUE="*">Todas</OPTION>
    <?php 
    
//$sql1 = "SELECT * FROM lav $filtro $where $condicion GROUP BY nombre ORDER BY nombre ASC";
    
$sql1="SELECT* FROM lav";
    
$result1mysql_query($sql1,$db_link) or die (mysql_error());
    while (
$row1=mysql_fetch_array($result1)){
    if (
$row1['nombre'] == $nombre)echo "<option value='".$row1['nombre']."' selected>".$row1['nombre']."</option>";else echo "<option value='".$row1['nombre']."'>".$row1['nombre']."</option>";}echo "</select>";
    
    
?>
    </SELECT>

    <select name='estado' onchange='submit();'>  
    <OPTION VALUE="*" selected>--estado--</OPTION>
    <OPTION VALUE="*">Todos</OPTION>
    <?php //$sql2 = "SELECT * FROM lav $filtro $where $condicion GROUP BY estado ORDER BY estado ASC";
    
$sql2 "SELECT * FROM lav";
    
$result2mysql_query($sql2,$db_link) or die (mysql_error());
    while (
$row2=mysql_fetch_array($result2)){
    if (
$row2['estado'] == $estado)echo "<option value='".$row2['estado']."' selected>".$row2['estado']."</option>";else echo "<option value='".$row2['estado']."'>".$row2['estado']."</option>";}echo "</select>";?>

    </SELECT>
    
    <select name='mail' onchange='submit();'>  
    <OPTION VALUE="*" selected>--mail--</OPTION>
    <OPTION VALUE="*">Todos</OPTION>
    <?php //$sql3 = "SELECT * FROM lav $filtro $where $condicion GROUP BY mail ORDER BY mail ASC";
    
$sql3 "SELECT * FROM lav";
    
$result3 mysql_query($sql3,$db_link) or die (mysql_error());
    while (
$row3=mysql_fetch_array($result3)){if ($row3['mail'] == $mail)echo "<option value='".$row3['mail']."' selected>".$row3['mail']."</option>";else echo "<option value='".$row3['mail']."'>".$row3['mail']."</option>";}echo "</select>";?>
    </SELECT>

    <select name='id' onchange='submit();'>  
    <OPTION VALUE="*" selected>--id--</OPTION>
    <OPTION VALUE="*">Todos</OPTION>
    <?php //$sql4 = "SELECT * FROM lav $filtro $where $condicion GROUP BY id ORDER BY id ASC";
    
$sql4 "SELECT * FROM lav";
    
$result4 mysql_query($sql4,$db_link) or die (mysql_error());
    while (
$row4=mysql_fetch_array($result4)){if ($row4['id'] == $id)echo "<option value='".$row4['id']."' selected>".$row4['id']."</option>";else echo "<option value='".$row4['id']."'>".$row4['id']."</option>";}echo "</select>";?>
    </SELECT>
    </form>
    <TABLE align=center width=100% border=1>
    <TR><td align=center><b>id</td>
    <td align=center><b>mail</td>
    <td align=center><b>estado</td>
    <td align=center><b>mail</td>
    <td align=center><b>alerta</td>
             


<?php 
$i
=0;
while (
$i $num){
$id=mysql_result($result,$i,"id");
$nombre=mysql_result($result,$i,"nombre");
$estado=mysql_result($result,$i,"estado");
$mail=mysql_result($result,$i,"mail");?>

  <TR><td><center><?php echo $id;?></td>
      <td><center><?php echo $nombre?> </td>
      <td><center><?php echo $estado?> </td>
      <td><center><?php echo $mail?> </td>
      <td><center><a> VER </a></td>
  </TR><?php $i++;}?>
               </TABLE>          
              </BODY>
              </HTML>

entiendo que mi error esta en la logica d ela tabla pero soy aun algo nuevo y no le encuentro el problema ^^

si hace el filtro pero salen muchso warnings :P

podrian alguien darme una mano O.Q!!! gracias de antemano :))