Re: Help a newbie

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In message <BAY124-W7422EEC508B00E49C6E08AB7B0@xxxxxxx>, Ankit Mathur
<ankitmathur82@xxxxxxxxxxx> writes
>Now the new query is to display results across pages like first 10 on first page 
>& 11-20 on second page.I hope you'd be able to help me out.
> 
>My SQL Query:
> 
>SELECT U.userid, U.tariffid, TP.tariff_table_name, U.balanceFROM users u, 
>tariffplans tp
> 
>I'm getting more than 1000 records for this query. So I want to break up results 
>across pages. Can I do so in PHP?

That is called pagination.  You need the LIMIT command in the SQL. 

SELECT U.userid, U.tariffid, TP.tariff_table_name, U.balanceFROM users
u, tariffplans tp LIMIT 0,10;
for the first 10

SELECT U.userid, U.tariffid, TP.tariff_table_name, U.balanceFROM users
u, tariffplans tp LIMIT 10,10;
for the second 10.

etc... so very simply, put variables into the SQL command, and change
them according to which page you want to appear.

-- 
Pete Clark

Sunny Andalucia
http://www.hotcosta.com/comm_1.htm

[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux