1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: php+mysql help

Discussion in 'Web Design & Development' started by nipunahasanka, Jan 1, 2011.

Thread Status:
Not open for further replies.
  1. nipunahasanka

    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.
     
  2. TechGuy

    TechGuy Administrator

    Joined:
    Feb 12, 1999
    Messages:
    14,240
    First Name:
    Mike
    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!
     
  3. nipunahasanka

    nipunahasanka Thread Starter

    Joined:
    Dec 1, 2010
    Messages:
    21
    Thanx tech guy
    I have understand it.
     
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 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/972052

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice