Php 在mysql中选择一个值范围

Php 在mysql中选择一个值范围,php,mysql,Php,Mysql,除了MySql查询中的前3行外,我如何选择所有行 $query = mysql_query("SELECT * FROM comments WHERE approved = 1"); 是否需要以下内容: $query = mysql_query("SELECT * FROM comments WHERE approved = 1"); $rowCount = 0; while ($row = mysql_fetch_assoc($query)) { $rowCount = $row

除了MySql查询中的前3行外,我如何选择所有行

$query = mysql_query("SELECT * FROM comments WHERE approved = 1");  

是否需要以下内容:

$query = mysql_query("SELECT * FROM comments WHERE approved = 1");
$rowCount = 0;
while ($row = mysql_fetch_assoc($query)) {
    $rowCount = $rowCount + 1;
    // do stuff only if you have reached the third row.
    if ($rowCount > 3){
        // do stuff here
    }
}

是否需要以下内容:

$query = mysql_query("SELECT * FROM comments WHERE approved = 1");
$rowCount = 0;
while ($row = mysql_fetch_assoc($query)) {
    $rowCount = $rowCount + 1;
    // do stuff only if you have reached the third row.
    if ($rowCount > 3){
        // do stuff here
    }
}

要按列名查找第三个记录顺序,请使用

$query = mysql_query("SELECT * FROM comments
                                     WHERE approved = 1 
                                     ORDER BY columnName 
                                     LIMIT 2, 1");
要查找除前3行以外的所有行,请使用限制2,行总数

如果您不知道行的总数,请使用非常大的数字来代替它

$query = mysql_query("SELECT * FROM comments
                                     WHERE approved = 1 
                                     ORDER BY columnName 
                                     LIMIT 2, total_no_of_rows");
要按列名查找第三个记录顺序,请使用

$query = mysql_query("SELECT * FROM comments
                                     WHERE approved = 1 
                                     ORDER BY columnName 
                                     LIMIT 2, 1");
要查找除前3行以外的所有行,请使用限制2,行总数

如果您不知道行的总数,请使用非常大的数字来代替它

$query = mysql_query("SELECT * FROM comments
                                     WHERE approved = 1 
                                     ORDER BY columnName 
                                     LIMIT 2, total_no_of_rows");

根据什么标准你定义“第一”?不管我如何排序,我都希望它是工作。根据什么标准你定义“第一”?不管我如何排序,我都希望它是工作。可能的重复只是前2个。这只是前2个。