On 11/3/07, Eduardo Vizcarra <[EMAIL PROTECTED]> wrote: > > Hi guys > > After doing some changes, I believe it is partially working, what I did is > the following: > while($row=mysql_fetch_array($fotos)) > { > $fotos_mostrar[] = $row; > } > $primer_foto = reset($fotos_mostrar[0]); // This is to set the pointer > to > the first record > echo $primer_foto; // This displays the first column when doing a SELECT > > However, my SELECT statement retrieves 2 columns from one table, how do I > display the second column ? > > Thanks > Eduardo
Since you're pulling 2 columns, why don't you use MYSQL_ASSOC option? Example... [code] $query = "SELECT column1, column2 FROM table WHERE (...)"; ... while ($row = mysql_fetch_array ($fotos, MYSQL_ASSOC)) { $fotos_mostrar['col1'][] = $row['column1']; $fotos_mostrar['col2'][] = $row['column2']; } ... // To view the contents of what you just created echo "<pre>"; print_r ($fotos_mostrar); echo "</pre>"; [/code] By doing it this way, you know exactly what you're storing and where. Hopefully I didn't muddy things up! ;-) ~Philip