Solved: php+mysql help

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

nipunahasanka

Thread Starter
Joined
Dec 1, 2010
Messages
21
hello.

I hv a database named lankavis_webs and there is a table named sl_hits. The fied are in the table like this,

id, song, artist, bitrate, dowload_url, views, downloads, lyrics, datetime.

There are about 1000 records in the data table.
I want to get output rows as last 25 record in 1.php and next 25-50 from last in 2.php and go ahead like it.
Already i have made fecth arry to display data . But i want to know how to select rows range like above.
Please help me.
 

TechGuy

Mike
Administrator
Joined
Feb 12, 1999
Messages
14,769
Look up using "LIMIT" inside your SELECT like this:

SELECT * from sl_hits LIMIT 1,25;

SELECT * from sl_hits LIMIT 26,25;

SELECT * from sl_hits LIMIT 51,25;

etc

Note that the second number (25) is the number of results to return and would be 25 in your example.

It would probably be easier to create a single .php file and set a variable to increase that number rather than make a bunch of php files... Good luck!
 

nipunahasanka

Thread Starter
Joined
Dec 1, 2010
Messages
21
Look up using "LIMIT" inside your SELECT like this:

SELECT * from sl_hits LIMIT 1,25;

SELECT * from sl_hits LIMIT 26,25;

SELECT * from sl_hits LIMIT 51,25;

etc

Note that the second number (25) is the number of results to return and would be 25 in your example.

It would probably be easier to create a single .php file and set a variable to increase that number rather than make a bunch of php files... Good luck!
Thanx tech guy
I have understand it.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top