You are here: Re: LIMIT clause problems « PHP Programming Language « IT news, forums, messages
Re: LIMIT clause problems

Posted by Morris on 08/06/05 14:01

Andy Hassall <andy@andyh.co.uk> wrote in
news:2959f1t5ki491psusprmr0uofm2gsqrnl6@4ax.com:

> On Sat, 06 Aug 2005 10:42:33 GMT, Mike <user@domain.com> wrote:
>
>> $cur_page = $_GET['next_page'];
>> $page_num = $cur_page + 1;
>> $record = ($cur_page * $records_per_page) + 5;
>> $total_num_page = $last_page_num = ceil($total_recs/
>>$records_per_page);
>>
>> $limit_str = "LIMIT ". $cur_page * $records_per_page . ",
>> $record";
>
> http://dev.mysql.com/doc/mysql/en/select.html
> [LIMIT {[offset,] row_count | row_count OFFSET offset}]
>
> It's not LIMIT from_offset, to_offset.
> it's LIMIT offset, row_count.
>
> So surely something more like:
>
> $limit_str = "LIMIT ". $cur_page * $records_per_page . ",
> $records_per_page";
>

Yep, that works fine. Thanks.

The book I'm using wasn't clear how to use the LIMIT clause, and it
looked like it was from_offset, to_offset. The sample code provided
*definitely* produces from_offset, to_offset.

Wrox are normally very good, but "Beginning PHP5" is not up to standard.
I've noticed quite a few typos in sample code.

I'll just have to make more use of the official documentation.

Mike

Mike

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация