Results 1 to 2 of 2

Thread: help with to divide database news to pages

  1. #1

    help with to divide database news to pages

    hi everyone
    i want to build pagination with PHP but i cannot
    for ex i have 100 number of news and i like my page show only 10 news per page so let it displays 10 page and below let it is written
    page1, page2, page3, and whenever i want to click on this pages let it goes the page which is clicked
    this my database sql.
    CREATE TABLE `news` (
      id int(11) NOT NULL auto_increment,
      theme varchar(200) NOT NULL default '',
      author varchar(100) NOT NULL default '',
      date date NOT NULL default '0000-00-00',
      text text NOT NULL,
      PRIMARY KEY  (id)
    ) TYPE=MyISAM;
    i did like this but it doesnt work
    $q="SELECT count(*) FROM `news`";
    echo '<h1>news</h1>';
    $sql="SELECT * FROM `news` ";
    for ($i=0; $i<$num_results; $i++)
        echo '<b>'.$theme.'</b><br>
        <a href="/news/'.$id.'/">added by</a>: <b>'.$author.'</b> 
    ('.$date.')<p> '.$text.' <hr>';
    i need this script
    if possible pls see it
    Thanks for attention

  2. #2
    Join Date
    Dec 2009

    This will take care of everything for you.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center