[PHP] Re: Database Function

2001-09-02 Thread Alfredo Yong

look here: http://www.bitmechanic.com/mail-archives/mysql/Jun1998/0387.html

An extract:


Write this:

select * from table_name limit 100
select * from table_name limit 100, 100
select * from table_name limit 200, ( what number you want)..


On Mon, 15 Jun 1998, Joe Walnes wrote:


 > Hi. I am fairly new to MySQL. Is there a way to return only certain pages
 > from a SELECT query.
 >
 > By this I mean, suppose a query returns 1000 results, can I refine 
this to
 > only results 1-100, or 101-200, and so forth?
 >
 > Thanks in advance.
 >
 > -Joe Walnes.



Georgie wrote:

> I have a simple php script that searchs a MySQL database and returns results
> that I made myself and I'm trying to implement code that splits the results
> into x amount of pages, buts it really tricky.
> 
> Can anyone give me a link to some code or even better, a search database
> script that I could adapt for my own needs?
> 
> Thanks
> 
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Database Function

2001-09-02 Thread Hugh Bothwell


"Georgie" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have a simple php script that searchs a MySQL database and returns
results
> that I made myself and I'm trying to implement code that splits the
results
> into x amount of pages, buts it really tricky.

... if you want X results per page, look at the LIMIT clause for your
SQL statements.

If you actually meant X _pages_ (... I don't see where this would be
useful, but hey...) I would check the number of returned results
with mysql_num_rows(), calculate the start-row offset, and then
mysql_data_seek() to the place you want.

Either way, it's actually pretty simple.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]