是短而简单:我的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