是短而簡單:我的PHP while ($R = mysql_fetch_asoc($sql)
結果並循環-1 ... 所以當我有4個結果只顯示3, 沒有任何人知道如何解決這個問題?while循環做-1(mysql_fetch_assoc)
0
A
回答
3
這是最常見的原因,因爲您在第一時間之前致電mysql_fetch_assoc($sql)
。
像這樣:
$firstRow = mysql_fetch_assoc($sql);
while ($R = mysql_fetch_assoc($sql) {
//> Dataset with -1 row
}
修復有:
mysql_data_seek($query,0);
while ($R = mysql_fetch_assoc($sql) {
+0
的'結果好吧,你絕對正確。但是我需要這個之前的那個...... S:那我該如何解決它? –
+0
我是一個千里眼的大聲笑。無論如何看到編輯。 – dynamic
1
補充@職場英語對話回答:
$R = mysql_fetch_assoc($sql);
// code that needs that first call to mysql_fetch_assoc()
do {
//code
} while (($R = mysql_fetch_assoc($sql));
相關問題
- 1. C++ while循環做最大1次
- 2. PHP嵌套While循環不mysql_fetch_assoc
- 3. 做while while循環永遠
- 4. double做while循環
- 5. Haskell - 做while循環
- 6. QT做while循環
- 7. infinte做while循環
- 8. Haskell做while循環
- 9. 做while循環不正常循環
- 10. do while循環不循環也不做
- 11. while(1)循環無限循環的TAC
- 12. 做..在C#while循環嗎?
- 13. 做/ while循環不工作?
- 14. while循環做了什麼?
- 15. 爲AJAX做while循環?
- 16. 做while循環在PHP
- 17. 在Swift中做while循環
- 18. setTimeout在做while while循環時
- 19. 麻煩做一個while while循環
- 20. JS掛在做while while循環
- 21. 做while循環嵌套兩個while
- 22. 2 while循環VS如果else語句在1 while循環
- 23. while while while循環while循環
- 24. 雖然做while循環的同時做
- 25. 做while循環 - 只有兩次循環 - 應循環8次
- 26. while while循環
- 27. while while循環
- 28. 如何做2 PHP的while循環與1 MySQL的查詢?
- 29. 警告:mysql_fetch_assoc()期望在while循環中出現參數錯誤
- 30. while循環和mysql_fetch_assoc在一個查詢上?
是$ sql中的mysql_query( 「查詢」)' – Ibu