简体   繁体   English

从数据库中逐行获取值

[英]Get values from database from row to row

I'm trying to select values from row 85 in this while loop. 我试图在while循环中从第85行中选择值。 So all values that are selected in the database before row 85 should be excluded in the while loop, and everyone above 85 should be "Do Something" with. 因此,应该在while循环中排除数据库中第85行之前选择的所有值,并且高于85的每个人都应该“做某事”。

Any suggestions how to achieve this? 任何建议如何实现这一目标?

$to_emails = mysql_query("SELECT * FROM ".$DBprefix."users WHERE workouts > 10");

while ($to_email = mysql_fetch_array($to_emails)) {
    // Do Something        
}

Look here: 看这里:

To retrieve all rows from a certain offset up to the end of the result set, you can use some large number for the second parameter. 要检索从某个偏移量到结果集结尾的所有行,可以为第二个参数使用较大的数字。 This statement retrieves all rows from the 96th row to the last: 该语句检索从第96行到最后一行的所有行:

SELECT * FROM tbl LIMIT 95,18446744073709551615; 选择* FROM tbl LIMIT 95,18446744073709551615;

http://dev.mysql.com/doc/refman/5.0/en/select.html http://dev.mysql.com/doc/refman/5.0/en/select.html

So try something like this: 所以尝试这样的事情:

$to_emails = mysql_query("
          SELECT * FROM ".$DBprefix."users 
          WHERE workouts > 10
          LIMIT 85,18446744073709551615");

Try like 尝试像

$to_emails = mysql_query("SELECT * FROM ".$DBprefix."users WHERE workouts > 10 LIMIT 85,200");

Or even try like(May be it works) 甚至尝试一下(也许可行)

$to_emails = mysql_query("SELECT * FROM ".$DBprefix."users WHERE workouts > 10 LIMIT 85,(SELECT COUNT(*) FROM ".$DBprefix."users");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM