# Php/mysql limit function, help

**URL:** <https://forum.kirupa.com/t/php-mysql-limit-function-help/139103>\
**Category:** Uncategorized\
**Created:** [February 28, 2005, 4:21pm UTC](https://forum.kirupa.com/t/php-mysql-limit-function-help/139103 "2005-02-28T16:21:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nobody](https://avatars.discourse-cdn.com/v4/letter/n/94ad74/32.png) [@nobody](https://forum.kirupa.com/u/nobody)\
**Post date:** [February 28, 2005, 4:21pm UTC](https://forum.kirupa.com/t/php-mysql-limit-function-help/139103/1 "2005-02-28T16:21:33Z")

</div>

Hey guys and gals.  
I’m trying to pull the top two rows off of my mysql database through php, sorting by ID. I’m just having a sliiiight problem doing it. This is the code I’m using to query the database at the moment.

```php
$query = mysql_query( " SELECT * FROM mainpage WHERE page = 1 ORDER BY ID DESC LIMIT 0 , 2 " );

```
