php + database = how to surf my mini articles directory ?

Discussion in 'PHP' started by danion, Feb 2, 2008.

  1. #1
    -------
    Database: `articlesdirectory`
    --------
    Table structure for table `articles`

    CREATE TABLE `articles` (
    `id` int(11) NOT NULL auto_increment,
    `category` varchar(100) NOT NULL default '',
    `title` varchar(255) NOT NULL default '',
    `articletext` longtext NOT NULL,
    PRIMARY KEY (`id`),
    KEY `category` (`category`),
    FULLTEXT KEY `title` (`title`),
    FULLTEXT KEY `articletext` (`articletext`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=230456 ;
    -------

    My problem is to wiew (surf):

    * in first .PHP page, category links
    * in second .PHP page, article titles links from selected category
    * in last .PHP page, article selected.


    Please tutorials or script to surf my mini articles directory.:eek:

    Thanks
     
    danion, Feb 2, 2008 IP
  2. HoagieKat

    HoagieKat Peon

    Messages:
    87
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    category links - "SELECT category FROM articles GROUP BY category" - will output all categories

    article titles - "SELECT id,title FROM articles WHERE category={$category}" - will output all article titles within that category

    last page - "SELECT * FROM articles WHERE id={$id}" - outputs just the article from MySQL

    I'll leave it to you to work out the rest of the .php, cos it's more than a 5 minute job.
     
    HoagieKat, Feb 2, 2008 IP
  3. danion

    danion Active Member

    Messages:
    1,825
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    78
    #3
    Thanks for help
     
    danion, Feb 2, 2008 IP