Looking for help to create a script to pull info from existing database..

Discussion in 'PHP' started by Kaediem, Apr 6, 2007.

  1. #1
    I'm very new to this whole database thing but what I'm looking for is either a tutorial or someone generous that would tell me what code would enable me to get specific stuff out of the database.

    I have -

    ID
    Author
    Data

    I want to pull the information by author and display all the data that goes with the author on a page.

    Thanks in advance to anyone who can tell me how to do this or point me at a tutorial.

    Lisa
     
    Kaediem, Apr 6, 2007 IP
  2. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #2
    Do you want this script so that you can view the data? Or to display it on a site?

    If you want to use it on a site, it might be easier to import the data into an existing cms database. Those 3 fields are fairly common.
     
    Colbyt, Apr 6, 2007 IP
  3. Kaediem

    Kaediem Well-Known Member

    Messages:
    1,128
    Likes Received:
    118
    Best Answers:
    0
    Trophy Points:
    150
    #3
    display on the site.... I downloaded joomla (a cms right?) but couldn't figure out how to set it up to use my database... maybe I'll look at it again.

    Lisa
     
    Kaediem, Apr 6, 2007 IP
  4. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #4
    Open you SQL dump in notepad or notepad2 and paste the table structure here or PM me with it.

    I know nothing about Joomla but there are a lot of free/low cost cms scripts out there.
     
    Colbyt, Apr 6, 2007 IP
  5. Kaediem

    Kaediem Well-Known Member

    Messages:
    1,128
    Likes Received:
    118
    Best Answers:
    0
    Trophy Points:
    150
    #5
    -- Table structure for table `filedb`
    --

    CREATE TABLE `filedb` (
    `id` int(10) unsigned NOT NULL auto_increment,
    `author` varchar(255) NOT NULL default '',
    `file` mediumtext NOT NULL,
    PRIMARY KEY (`id`),
    KEY `idx_author` (`author`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=21815 ;

    --
    -- Dumping data for table `filedb`

    Lisa
     
    Kaediem, Apr 6, 2007 IP
  6. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #6
    Let me take a look at of couple of things on my hard drive and get back to you. Those are fairly standard definations.

    Should have asked if this is a new site or if you want to match an existing design.

    Are you comfortable working with phpAdmin?
     
    Colbyt, Apr 7, 2007 IP
  7. Kaediem

    Kaediem Well-Known Member

    Messages:
    1,128
    Likes Received:
    118
    Best Answers:
    0
    Trophy Points:
    150
    #7
    thanks colbyt - no I haven't designed anything yet.

    Lisa
     
    Kaediem, Apr 7, 2007 IP
  8. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #8
    I'm feel fairly sure there is a better helper than me on this forum.

    Here is the database structure for 3 different cms products. It looks like what you have could be imported into any of them with a little tweaking. I am not the person who can do that. At least not yet. :)

    From the cms database

    CREATE TABLE article
    (
    article_id INTEGER AUTO_INCREMENT PRIMARY KEY,
    title VARCHAR(250) NOT NULL,
    author VARCHAR(100) NOT NULL,
    category_id INTEGER NOT NULL,
    summary TEXT NOT NULL,
    text TEXT NOT NULL,
    time INTEGER NOT NULL,
    network_id INTEGER NOT NULL,
    KEY(category_id, title),
    FULLTEXT(title, text),
    FULLTEXT(title)
    ) TYPE=MyISAM;

    --------------------------------------------------------

    -- Table structure for table `article_master`
    --

    CREATE TABLE `article_master` (
    `article_id` bigint(20) NOT NULL auto_increment,
    `article_user_id` int(11) NOT NULL default '0',
    `article_author` varchar(100) NOT NULL default '',
    `article_snippet` varchar(255) NOT NULL default '',
    `article_summary` text NOT NULL,
    `article_title` varchar(100) NOT NULL default '',
    `article_category_id` int(11) NOT NULL default '0',
    `article_views` bigint(20) NOT NULL default '0',
    `article_status` int(11) NOT NULL default '1',
    `article_date` date NOT NULL default '0000-00-00',
    `article_home_page` int(11) NOT NULL default '0',
    `article_email` int(11) NOT NULL default '0',
    PRIMARY KEY (`article_id`)

    --------------------------------------------------------
    wordpress:

    CREATE TABLE IF NOT EXISTS `wp_categories` (
    `cat_ID` bigint(20) NOT NULL auto_increment,
    `cat_name` varchar(55) NOT NULL default '',
    `category_nicename` varchar(200) NOT NULL default '',
    `category_description` longtext NOT NULL,
    `category_parent` bigint(20) NOT NULL default '0',
    `category_count` bigint(20) NOT NULL default '0',
    PRIMARY KEY (`cat_ID`),
    KEY `category_nicename` (`category_nicename`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;

    Of the three, the cms script at the top of the list is by far the easiest to create a custom skin for. I have a default installation of that cms running at quickcooks.com. You can literally make it look anyway you want and include the functions to produce the results. Very much like using the include function of php. I will tell you where you can get a free copy if you leave the backlink and I think I paid $10 for the license to remove that.

    Wordpress is the best know of the 3 and it is free. I find skinning it to be cumbersome. The article script I have not worked with at all.
     
    Colbyt, Apr 7, 2007 IP
    Kaediem likes this.
  9. Kaediem

    Kaediem Well-Known Member

    Messages:
    1,128
    Likes Received:
    118
    Best Answers:
    0
    Trophy Points:
    150
    #9
    Thanks Colbyt - where did you get the cms script?

    Lisa
     
    Kaediem, Apr 7, 2007 IP