Second while loop not running. Why?

后端 未结 6 1852
没有蜡笔的小新
没有蜡笔的小新 2021-01-15 11:37

I have two while loops running one after the other (not inside of each other) - I\'ve simplified the code a bit so that only the important parts of it are listed below. The

6条回答
  •  不思量自难忘°
    2021-01-15 11:54

    You have already reached the end of your result set, but you can use mysql_data_seek to reset it.

    // query your database
    $result = mysql_query(...);
    // loop through results
    while(($row = mysql_fetch_assoc($result))) {
    }
    // reset result set
    mysql_data_seek($result,0);
    // loop again
    while(($row = mysql_fetch_assoc($result))) {
    }
    

提交回复
热议问题