Page 1 of 1

Simple Question - Limit by.. Start number #

Posted: Sat Sep 23, 2006 5:04 am
by Qaid
Hi,

I have a code where I limit the MySQL database to a maximum of 5 post, then and ad is displayed, then i have the same code again, but how do i then start from post 6 to 10?

Thanks
Qaid

Posted: Sat Sep 23, 2006 5:09 am
by aaronhall
LIMIT {row to begin at}, {number of rows to fetch}

so....

"LIMIT 0, 5" then "LIMIT 5, 5"

Re: Simple Question - Limit by.. Start number #

Posted: Sat Sep 23, 2006 5:42 am
by aerodromoi
Qaid wrote:Hi,

I have a code where I limit the MySQL database to a maximum of 5 post, then and ad is displayed, then i have the same code again, but how do i then start from post 6 to 10?

Thanks
Qaid
Just as a suggestion - why don't you read the database output into an array (mysql_fetch_array) and insert the ad while looping through the array (while printing out its contents)? This way you don't need two queries.