MySQL Select İkinci Satır

0 Cevap php

Ben bir mysql sorum var.


I have a news section on my website, and I want to display the two latest items. If I do:

SELECT * FROM nieuws ORDER BY id DESC LIMIT 1

it selects the latest item, and now I want to select the second to last item.

Siz bunu nasıl biliyor musunuz?

/ / / EDIT

Şimdi bu işe yaramazsa, benim kod: (Ben ;) dahil bağlamak var)

            $select = mysql_query("SELECT * FROM nieuws ORDER BY id DESC LIMIT 1");
            while($row = mysql_fetch_assoc($select)) {
            $datum = $row['time'];
            $titel = $row['title'];
            $bericht = $row['message'];
            ?>
            <div class="entry">

                <span class="blue date"><?php echo "$datum"; ?></span>
                <h3><?php echo "$titel"; ?></h3>
                <p><?php echo "$bericht"; ?></p> <br />
            </div><!-- end of entry --> <?php } ?>
            <?php 
            $select2 = mysql_query("SELECT * FROM nieuws ORDER BY id DESC LIMI 1, 1");
            while($row2 = mysql_fetch_assoc($select2)) {
                $datum = $row2['time'];
                $titel = $row2['title'];
                $bericht = $row2['message'];
                ?>
            <div class="entry">
                <span class="green date"><?php echo "$datum"; ?> </span>
                <h3><?php echo "$titel"; ?></h3>
                <p><?php echo "$bericht"; ?></p>
            </div> <!-- end of entry --> <?php } ?>
        </div><!-- end of news --> 

0 Cevap