Why so deduces:

while ($row = mysql_fetch_array($r, MYSQL_ASSOC)) { echo "$row[id]\t\t\t$row[text]\t\t\t$row[date]<br>"; } 

and if so, then two times does not display:

  while ($row = mysql_fetch_array($r, MYSQL_ASSOC)) { echo "$row[id]\t\t\t$row[text]\t\t\t$row[date]<br>"; } while ($row = mysql_fetch_array($r, MYSQL_ASSOC)) { echo "$row[id]\t\t\t$row[text]\t\t\t$row[date]<br>"; } 

The meaning is the same .... Why?

  • @ mkrichet1, If ​​you are given an exhaustive answer, mark it as correct (click on the check mark next to the selected answer). - terantul
  • Semyachki ended) - Ale_x

3 answers 3

Because the first while already went through all the results.

  • And what to do? How to re-call ??? - mkrichet
  • @ mkrichet1, flush the results to an array or repeat the query to the database. - etki
  • @Ale_x wow, I thought that there was no such thing, that the database itself fetches the recording and transmits it, so you can't rewind it. - etki

@Etki , like mysql_data_seek () serves for such purposes, just set the internal pointer to zero.

     $r2 = $r; while ($row = mysql_fetch_array($r, MYSQL_ASSOC)){ echo "$row[id]\t\t\t$row[text]\t\t\t$row[date]<br>"; } while ($row2 = mysql_fetch_array($r2, MYSQL_ASSOC)) { echo "$row2[id]\t\t\t$row2[text]\t\t\t$row2[date]<br>"; }