Re: Getting info with WHILE

From: Date: Tue, 14 Jan 2003 03:38:05 +0000
Subject: Re: Getting info with WHILE
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-131508@lists.php.net to get a copy of this message
Hi, Tuesday, January 14, 2003, 1:09:10 PM, you wrote: ES> I have the following problem: ES> I have a DB named 'fotografias' with the following information: ES> ind indice_bio url ES> 1 2 ../images/agosti.jpg ES> 2 2 ../images/militar.jpg ES> 3 2 hgfhgfh ES> 4 2 eze ES> 5 5 ezequi ES> ind, indice_bio and url are fields names. ES> I wrote the following code: ES> <?php ES> $dbase = mysql_connect("localhost", user , password); ES> mysql_select_db(historia,$dbase); ES> $respuesta = mysql_query("SELECT * FROM fotografias where indice_bio=$id", ES> $dbase); ES> $row1 = mysql_fetch_array($respuesta); ES> echo("<center>"); ES> echo('<img border="0" src="../images/foto.wmf" ES> width="62" height="66">'); ES> echo('<b>Hagá Click para ver las fotografías disponibles</b>'); ES> echo("<br>"); ES> echo("<br>"); ES> while($row1 = mysql_fetch_array($respuesta)) ES> printf("<tr><td>&nbsp;%s&nbsp;</td></tr>", ES> $row1["url"]); ES> echo("<br>"); ES> } ES> mysql_free_result($respuesta); ES> mysql_close($dbase); ?>> ES> The problem is that when I retrieve the info, for example with id=2, I only ES> get ES> ../images/militar.jpg ES> hgfhgfh ES> eze ES> I do not get ES> ../images/agosti.jpg ES> Any idea? ES> Thanks ES> Ezequiel ES> Ps. The page is located at ES> http://www.historiadelpais.com.ar/bio.php?id=2 $respuesta = mysql_query("SELECT * FROM fotografias where indice_bio=$id",$dbase); $row1 = mysql_fetch_array($respuesta); <<<<<<<< get rid of this line, you don't need it. echo("<center>"); -- regards, Tom

« previous php.general (#131508) next »