Ver Mensaje Individual
  #1 (permalink)  
Antiguo 02/06/2010, 08:49
Avatar de yoyoyo82
yoyoyo82
 
Fecha de Ingreso: julio-2009
Ubicación: Springfield
Mensajes: 159
Antigüedad: 14 años, 9 meses
Puntos: 1
Error en Foreach

Tengo un buscador mediante el cual se le solicita a las personas teclear un id x para que encuentre datos e imagenes de un usuario x
El problema es que tarda en entra el foreach no se si me explico es decir si pongo por primera vez x numero en el buscador me tira este error

Código PHP:
WarningInvalid argument supplied for foreach() in /home/tacopnet/public_html/pdf/consu.php on line 342 
Si me regreso al buscador pongo otro numero me vuelve a tirar el error
Repito el proceso es decir me regreso al buscador pongo x id y por fin me localiza las imagenes y datos correspondientes al id a que se debe este problema este es mi codigo

Código PHP:
foreach ( $ids as $idimg) --[COLOR="Red"]En esta linea me tira el error[/COLOR]

echo 
"<table border='1' cellspacing='2' cellpadding='6'>";
echo 
"<tr>";
echo 
"<th>"

   echo 
"<input type='text' name='ruta[]' value='$idimg' />";  //aca genero tantos hidden como imagenes haya
 
echo "</th>";
echo 
"</tr>";
echo 
"</table>";

 
  echo 
"</FORM>";
  } 
este codigo esta arriba del que puse de la linea de error
Código PHP:
$b=$_POST['caja1'];


$result=mysql_db_query("tacopnet_tacop","select * from  imagenes   where A66  LIKE '%{$b}%' ",$conec);
//Mostramos los registros
$contador=0;
while ($row=mysql_fetch_assoc($result))
{

echo '<img src="'.$row['ruta'].'" width="50%" height="50%">';
echo '</img>';

$ids[$contador]=$row['A66']; 
$contador++;

}
mysql_free_result($result);
mysql_close($conec);
echo "<p>";
$conec1=mysql_connect("10.33.143.3","tacopnet_root","y+y-u*u/");
$c=$_POST['caja1'];
$result1=mysql_db_query("tacopnet_tacop","select A1,A10,A11,A12,A13,A14,A15,A18,A19,A32 from  finiquito   where A66  LIKE '%{$c}%' ",$conec1);
while ($row1=mysql_fetch_array($result1))
{
echo "<table border='1' cellspacing='2' cellpadding='6'>";
echo "<tr>";
echo "<th>"; 
echo "Numero de Folio";
echo "</th>";
echo "<th>"; 
echo "Nombre";
echo "</th>";
echo "<th>"; 
echo "Domicilio";
echo "</th>";
echo "<th>"; 
echo "Colonia";
echo "</th>";

echo "<th>"; 
echo "Fecha de Inicio";
echo "</th>";
echo "<th>"; 
echo "Fecha de Terminacion";
echo "</th>";
echo "<th>"; 
echo "Asesor Tecnico";
echo "</th>";
echo "</tr>";
echo "<tr>";
echo "<td>"; 
echo " ".$row1['A1']. " ";
echo "</td>";
echo "<td>"; 
echo " ".$row1['A10']." ";
echo " ".$row1['A11']." ";
echo " ".$row1['A12']." ";
echo "</td>";
echo "<td>"; 
echo " ".$row1['A13']." ";
echo " ".$row1['A14']." ";
echo "</td>";
echo "<td>"; 
echo " ".$row1['A15']." ";
echo "</td>";
echo "<td>"; 
echo " ".$row1['A18']." ";
echo "</td>";
echo "<td>"; 
echo " ".$row1['A19']." ";
echo "</td>";
echo "<td>"; 
echo " ".$row1['A32']." ";
echo "</td>";

echo "</tr>"; 
echo "</table>";

}
mysql_free_result($result1);
mysql_close($conec1);


?>
<?
echo "<FORM method='post'  action='reportepdf.php' target='jose' onsubmit='jose = window.open(this.action , 'jose' , 'width=2000,height=2000')'>"
echo 
"<input type='submit' name='submit' value='Obtener Pdf'>"
echo 
"<input type='hidden' name='A66' id='A66' value='$c' />";
Saludos y gracias

Última edición por yoyoyo82; 02/06/2010 a las 09:22